<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtjavascript.inc.php");
use_unit("components4phpfull/jtheadercode.inc.php");
use_unit("components4phpfull/jtdivwindow.inc.php");
use_unit("components4phpfull/jtdatepicker.inc.php");
use_unit("components4phpfull/jtgroupbox.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("comctrls.inc.php");
use_unit("components4phpfull/jtpagecontrol.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Vehicle_Details extends Page
{
   public $Label49 = null;
   public $Memo1 = null;
   public $lblAssetNo = null;
   public $lblEquiptNo = null;
   public $edEquiptNo = null;
   public $edAssetNo = null;
   public $edRefPO = null;
   public $lblRef = null;
   public $edSection = null;
   public $lblSection = null;
   public $edDivision = null;
   public $lblDivision = null;
   public $lblGroup = null;
   public $edGroup = null;
   public $edCostCenter = null;
   public $lblCostCenter = null;
   public $lblBenefitPlan = null;
   public $edBenefitPlan = null;
   public $edIdNo = null;
   public $lblId = null;
   public $cmbBand = null;
   public $lblBand = null;
   public $chkFleet = null;
   public $lblmodel = null;
   public $lblmake = null;
   public $Label43 = null;
   public $Label38 = null;
   public $lblyear = null;
   public $lblplate = null;
   public $lblEmpName = null;
   public $lblEmpId = null;
   public $cmbCountryPur = null;
   public $edPStreet = null;
   public $Label108 = null;
   public $Label107 = null;
   public $cmbLTOFuel = null;
   public $Label106 = null;
   public $edDue = null;
   public $Label105 = null;
   public $edDispCity = null;
   public $cmbCountry = null;
   public $Label104 = null;
   public $Label103 = null;
   public $edStreet = null;
   public $Label101 = null;
   public $Label100 = null;
   public $btnCancelBody = null;
   public $btnReplaceBody = null;
   public $edRepDoor = null;
   public $edRepIgnitionCode = null;
   public $edRepIntColor = null;
   public $edRepIntCode = null;
   public $edRepPcolor = null;
   public $edRepPcode = null;
   public $Label99 = null;
   public $Label98 = null;
   public $Label97 = null;
   public $Label96 = null;
   public $edRepBodyNum = null;
   public $JTDivBody = null;
   public $Label102 = null;
   public $Label95 = null;
   public $Label94 = null;
   public $btnBody = null;
   public $btnBodyHistory = null;
   public $btnEnginehistory = null;
   public $btnEng = null;
   public $JTDivEngine = null;
   public $btnECancel = null;
   public $btnEReplace = null;
   public $repEngNum = null;
   public $Label93 = null;
   public $btnrepFuel = null;
   public $repEngCylinder = null;
   public $repEngFuel = null;
   public $Label92 = null;
   public $Label91 = null;
   public $repEngDisp = null;
   public $repEngAircon = null;
   public $repEngAspiration = null;
   public $Label90 = null;
   public $Label89 = null;
   public $Label88 = null;
   public $repEngCode = null;
   public $repEngPower = null;
   public $repEngTorque = null;
   public $Label87 = null;
   public $Label86 = null;
   public $Label85 = null;
   public $test = null;
   public $edBodyNum = null;
   public $Label84 = null;
   public $JSProvinceMunicipality = null;
   public $JSRegionProvince = null;
   public $cmbFuelType = null;
   public $edFuelCapacity = null;
   public $Label83 = null;
   public $Label82 = null;
   public $hfAttachment = null;
   public $lblattach = null;
   public $Label81 = null;
   public $uploadFile = null;
   public $JTJavaScript15 = null;
   public $JTJavaScript14 = null;
   public $JTJavaScript13 = null;
   public $JTDivType = null;
   public $JTGroupBox5 = null;
   public $btnAddType = null;
   public $btnDelType = null;
   public $edType = null;
   public $listType = null;
   public $btnShowType = null;
   public $JTDivWheel = null;
   public $JTGroupBox1 = null;
   public $btnAddWheel = null;
   public $btnDeleteWheel = null;
   public $edAddWheel = null;
   public $listWheel = null;
   public $JTDivRTire = null;
   public $JTGroupBox4 = null;
   public $btnAddRTire = null;
   public $btnDeleteRTire = null;
   public $edRTire = null;
   public $listRTire = null;
   public $JTDivTire = null;
   public $JTGroupBox2 = null;
   public $btnAddTire = null;
   public $btnDeleteTire = null;
   public $edTire = null;
   public $listSize = null;
   public $JTDivRWheel = null;
   public $JTGroupBox3 = null;
   public $btnAddRWheel = null;
   public $btnDeleteRWheel = null;
   public $edRWheel = null;
   public $listRWheel = null;
   public $dpDate = null;
   public $btnCancel = null;
   public $btnSubmit = null;
   public $dpOrDate = null;
   public $dpRegExpiration = null;
   public $jtdaterenew = null;
   public $jtdatecover = null;
   public $edPremium2 = null;
   public $edPremium1 = null;
   public $edOthersSum2 = null;
   public $edOthersSum1 = null;
   public $edCat2 = null;
   public $edCat1 = null;
   public $Label80 = null;
   public $Label79 = null;
   public $Label73 = null;
   public $Label72 = null;
   public $edAgentInsurance = null;
   public $edtotAmt = null;
   public $edtotPrice = null;
   public $edPrELPD = null;
   public $edamtELPD = null;
   public $edPrELBI = null;
   public $edamtELBI = null;
   public $edPrOD = null;
   public $edamtOD = null;
   public $edPrCTPL = null;
   public $edamtCTPL = null;
   public $Label78 = null;
   public $Label77 = null;
   public $Label76 = null;
   public $Label75 = null;
   public $Label74 = null;
   public $Label71 = null;
   public $Label65 = null;
   public $Label41 = null;
   public $Label40 = null;
   public $btnShowRTire = null;
   public $btnShowRWheel = null;
   public $btnShowFWheel = null;
   public $btnShowFTire = null;
   public $JTJavaScript12 = null;
   public $JTJavaScript11 = null;
   public $JTJavaScript10 = null;
   public $JTJavaScript9 = null;
   public $JTJavaScript8 = null;
   public $JTJavaScript7 = null;
   public $JTJavaScript6 = null;
   public $JTJavaScript5 = null;
   public $JTJavaScript4 = null;
   public $edhydraucap = null;
   public $edgearcap = null;
   public $edfreoncap = null;
   public $edtranscap = null;
   public $edoilcap = null;
   public $edhydraulic = null;
   public $edgearoil = null;
   public $edfreon = null;
   public $edtransfluid = null;
   public $edOilType = null;
   public $Label70 = null;
   public $Label69 = null;
   public $Label68 = null;
   public $Label67 = null;
   public $Label66 = null;
   public $Label64 = null;
   public $Label63 = null;
   public $Label62 = null;
   public $Label61 = null;
   public $Label60 = null;
   public $edDepreciation = null;
   public $edCurrentValue = null;
   public $edPeriod = null;
   public $edTotalPeriod = null;
   public $edTrade = null;
   public $Label59 = null;
   public $Label58 = null;
   public $Label57 = null;
   public $Label56 = null;
   public $Label46 = null;
   public $edDepDesc = null;
   public $Label45 = null;
   public $hiddenTabIndex = null;
   public $cmbMunicipality = null;
   public $cmbProvince = null;
   public $cmbRegion = null;
   public $edDisposalBldg = null;
   public $edDisposalAddress = null;
   public $Label55 = null;
   public $Label54 = null;
   public $Label53 = null;
   public $Label51 = null;
   public $Label44 = null;
   public $edother = null;
   public $Label50 = null;
   public $cmbsize = null;
   public $Label4 = null;
   public $compid = null;
   public $JTJavaScript3 = null;
   public $JTJavaScript2 = null;
   public $JTJavaScript1 = null;
   public $lblChassis = null;
   public $imgRegistration = null;
   public $edEngineNo = null;
   public $lblTransCode = null;
   public $edBodyNo = null;
   public $edAmt = null;
   public $edOrNo = null;
   public $edBy = null;
   public $edEncumbered = null;
   public $edComAddress = null;
   public $edOwner = null;
   public $edContact = null;
   public $edCapacity = null;
   public $edShipping = null;
   public $edNet = null;
   public $edGross = null;
   public $edMake = null;
   public $edSeries = null;
   public $edBodyType = null;
   public $edYear = null;
   public $edFuel = null;
   public $edCylinders = null;
   public $edPiston = null;
   public $edDenomination = null;
   public $edChassisNo = null;
   public $edPlateNo = null;
   public $edFileNo = null;
   public $edCrNo = null;
   public $edFieldOffice = null;
   public $edCurrOd = null;
   public $lblCurrOd = null;
   public $edodometer = null;
   public $lblOd = null;
   public $cmbtrack = null;
   public $lbltrackby = null;
   public $Label52 = null;
   public $edAircon = null;
   public $edChassis = null;
   public $imgBack = null;
   public $Image1 = null;
   public $edDevice = null;
   public $edSimNum = null;
   public $edGpsID = null;
   public $lblDevice = null;
   public $lblSimNum = null;
   public $lblGpsId = null;
   public $imgNoTire6 = null;
   public $imgNoTire5 = null;
   public $imgNoTire4 = null;
   public $imgNoTire3 = null;
   public $imgNoTire2 = null;
   public $imgNoTire1 = null;
   public $memoRemarks = null;
   public $lblRemarks = null;
   public $grpRear = null;
   public $edRearPsi = null;
   public $lblRearPsi = null;
   public $cmbRearTire = null;
   public $lblreartsize = null;
   public $cmbRearWheel = null;
   public $lblrearwsize = null;
   public $grpFront = null;
   public $edFrontPsi = null;
   public $lblFrontPsi = null;
   public $cmbFrontTire = null;
   public $lblFrontTire = null;
   public $cmbFrontWheel = null;
   public $lblFrontWheel = null;
   public $edTransCode = null;
   public $edRatio = null;
   public $lblRatio = null;
   public $edTransType = null;
   public $lblTransType = null;
   public $edDiffType = null;
   public $lblDiffType = null;
   public $grpAxle = null;
   public $chkL1 = null;
   public $lblLock = null;
   public $chkR6 = null;
   public $chkHidden11 = null;
   public $chkL6 = null;
   public $chkHidden10 = null;
   public $chkR5 = null;
   public $chkHidden9 = null;
   public $chkL5 = null;
   public $chkHidden8 = null;
   public $chkR4 = null;
   public $chkHidden7 = null;
   public $chkL4 = null;
   public $chkHidden6 = null;
   public $chkR3 = null;
   public $chkHidden5 = null;
   public $chkL3 = null;
   public $chkHidden4 = null;
   public $chkL2 = null;
   public $chkHidden2 = null;
   public $chkR2 = null;
   public $chkHidden3 = null;
   public $chkR1 = null;
   public $chkHidden1 = null;
   public $cmbType6 = null;
   public $cmbType5 = null;
   public $cmbType4 = null;
   public $cmbType3 = null;
   public $cmbType2 = null;
   public $chkLock = null;
   public $lblaxeltype = null;
   public $cmbType1 = null;
   public $lbldual = null;
   public $imageAddSpecification = null;
   public $imageAddJournal = null;
   public $imageAddEmission = null;
   public $edBuyerDisposal = null;
   public $dpRSDateDisposal = null;
   public $edSellingPriceDisposal = null;
   public $edOdometerDisposal = null;
   public $memoCommentsDisposal = null;
   public $edCompInsurance = null;
   public $edPolicyNum = null;
   public $edContactPerson = null;
   public $lblContact = null;
   public $hiddenId = null;
   public $Label48 = null;
   public $lblVeh = null;
   public $memoRemarksEngine = null;
   public $memoRemarksBody = null;
   public $edAccountNumPurchase = null;
   public $edLenderPurchase = null;
   public $dpLastPymntDue = null;
   public $dpFrstPymntDue = null;
   public $edMonthlyPymntPurchase = null;
   public $edTermPurchase = null;
   public $edInterestRatePurchase = null;
   public $edAmtBorrowedPurchase = null;
   public $memoCommentsPurchase = null;
   public $dpMnfrExpiration = null;
   public $edCityPurchase = null;
   public $edAddressPurchase = null;
   public $edPurchaseFrm = null;
   public $edPrice = null;
   public $dpPurchase = null;
   public $JTPlatinumGrid4 = null;
   public $Label47 = null;
   public $lblSellingPrice = null;
   public $lblRetireSalesDate = null;
   public $lblOdometer = null;
   public $lblSoldto = null;
   public $lblCertNum = null;
   public $JTPlatinumGrid3 = null;
   public $Label42 = null;
   public $lblPolicy = null;
   public $Label39 = null;
   public $lblAdress = null;
   public $JTPlatinumGrid2 = null;
   public $jtpageVehDetails = null;
   public $lblNotes = null;
   public $memoNotes = null;
   public $edDescription = null;
   public $lblDescription = null;
   public $edDeductable = null;
   public $Label37 = null;
   public $edCost = null;
   public $lblCost = null;
   public $edPhone = null;
   public $lblPhone = null;
   public $lblValidity = null;
   public $dpValidity = null;
   public $edCity = null;
   public $lblCity = null;
   public $edAddress = null;
   public $lblAddress = null;
   public $edCompany = null;
   public $lblCompany = null;
   public $edWarranty = null;
   public $lblWarranty = null;
   public $JTPlatinumGrid1 = null;
   public $Label36 = null;
   public $eddoorkey = null;
   public $Label35 = null;
   public $edignition = null;
   public $Label34 = null;
   public $edintcolor = null;
   public $Label33 = null;
   public $edpaintcolor = null;
   public $Label32 = null;
   public $edintcode = null;
   public $Label31 = null;
   public $edpaintcode = null;
   public $Label30 = null;
   public $Label29 = null;
   public $Label28 = null;
   public $cmbfuel = null;
   public $Label27 = null;
   public $Label26 = null;
   public $edaspiration = null;
   public $edtorque = null;
   public $Label25 = null;
   public $edcylinder = null;
   public $Label24 = null;
   public $eddisp = null;
   public $Label23 = null;
   public $Label22 = null;
   public $edpower = null;
   public $Label21 = null;
   public $edserialnum = null;
   public $Label20 = null;
   public $Label19 = null;
   public $edcode = null;
   public $Label18 = null;
   public $Label17 = null;
   public $Label16 = null;
   public $Label15 = null;
   public $Label14 = null;
   public $Label13 = null;
   public $Label12 = null;
   public $Label11 = null;
   public $Label10 = null;
   public $Label9 = null;
   public $Label8 = null;
   public $Label7 = null;
   public $Label6 = null;
   public $Label5 = null;
   public $Label3 = null;
   public $Label2 = null;
   public $Label1 = null;
   public $JTSiteTheme1 = null;
   function edBodyNoJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edBodyNum').value = document.getElementById('edBodyNo').value;
   <?php

   }

   function edBodyNumJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edBodyNo').value = document.getElementById('edBodyNum').value;
   <?php

   }

   function edCylindersJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edcylinder').value = document.getElementById('edCylinders').value;
   <?php

   }

   function cmbLTOFuelJSChange($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('cmbFuelType').value = document.getElementById('cmbLTOFuel').value;
   document.getElementById('cmbfuel').value = document.getElementById('cmbLTOFuel').value;
   <?php

   }

   function cmbFuelTypeJSChange($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('cmbLTOFuel').value = document.getElementById('cmbFuelType').value;
   document.getElementById('cmbfuel').value = document.getElementById('cmbFuelType').value;
   <?php

   }

   function cmbfuelJSChange($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('cmbLTOFuel').value = document.getElementById('cmbfuel').value;
   document.getElementById('cmbFuelType').value = document.getElementById('cmbfuel').value;
   //var fuel = document.getElementById('cmbfuel').value;
   //alert(fuel);
   <?php

   }

   function edcylinderJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edCylinders').value = document.getElementById('edcylinder').value;
   <?php

   }

   function edDueJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edDue").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edDue").value = numero;
   <?php

   }

   function edCurrentValueJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edCurrentValue").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edCurrentValue").value = numero;
   <?php

   }

   function edSellingPriceDisposalJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edSellingPriceDisposal").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edSellingPriceDisposal").value = numero;
   <?php

   }

   function edAmtJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edAmt").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edAmt").value = numero;
   <?php

   }

   function edMonthlyPymntPurchaseJSKeyUp($sender, $params)
   {

   ?>
   var numero = document.getElementById("edMonthlyPymntPurchase").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edMonthlyPymntPurchase").value = numero;

   <?php

   }

   function edAmtBorrowedPurchaseJSKeyUp($sender, $params)
   {

   ?>
   var numero = document.getElementById("edAmtBorrowedPurchase").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edAmtBorrowedPurchase").value = numero;

   <?php

   }

   function edPriceJSBlur($sender, $params)
   {

   ?>
   nStr = document.getElementById('edPrice').value;
	     x = nStr.split('.');
	     x1 = x[0];
	     x2 = x.length > 1 ? '.' + x[1] : '';
	     var rgx = /(\d+)(\d{3})/;
	     while (rgx.test(x1)) {
		   x1 = x1.replace(rgx, '$1' + ',' + '$2');
	     }
	     document.getElementById('edPrice').value = x1 + x2;

   <?php

   }

   function edPriceJSKeyUp($sender, $params)
   {

   ?>
   var numero = document.getElementById("edPrice").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPrice").value = numero;

   <?php

   }

   function btnBodyHistoryJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var veh_id = document.getElementById('hiddenId').value;
   var win_height = 344;
   var win_width = 850;
   var height = window.outerHeight;
   var width = window.outerWidth;
   var top = Math.round((height-win_height)/2);
   var left = Math.round((width-win_width)/2);
   window.open("body_list.php?veh_id="+veh_id, 'body_history', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
   <?php

   }

   function btnEnginehistoryJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var veh_id = document.getElementById('hiddenId').value;
   var win_height = 344;
   var win_width = 860;
   var height = window.outerHeight;
   var width = window.outerWidth;
   var top = Math.round((height-win_height)/2);
   var left = Math.round((width-win_width)/2);
   window.open("engine_list.php?veh_id="+veh_id, 'engine_history', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
   <?php

   }

   function btnReplaceBodyClick($sender, $params)
   {
   $result = mysql_query("insert into body_history_tbl (comp_id,
   veh_id,
   body_num,
   paint_code,
   paint_color,
   interior_code,
   interior_color,
   ignition_code,
   door_key)

   values ('".$_SESSION['company_id']."',
   '".$this->hiddenId->getValue()."',
   '".$this->edRepBodyNum->Text."',
   '".$this->edRepPcode->Text."',
   '".$this->edRepPcolor->Text."',
   '".$this->edRepIntCode->Text."',
   '".$this->edRepIntColor->Text."',
   '".$this->edRepIgnitionCode->Text."',
   '".$this->edRepDoor->Text."')")or die("INSERT BODY HISTORY - " . mysql_error());

   echo "<script type=text/javascript>
        alert('Body Replaced!');
        document.getElementById('JTDivBody').Hide();
        </script>";


   }

   function btnBodyJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   //document.getElementById('JTDivBody').Show();
   var veh_id = document.getElementById('hiddenId').value;
   var win_height = 164;
   var win_width = 657;
   var height = window.outerHeight;
   var width = window.outerWidth;
   var top = Math.round((height-win_height)/2);
   var left = Math.round((width-win_width)/2);
   window.open("replace_body.php?veh_id="+veh_id, 'replace_engine', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
   <?php

   }

   function edRepDoorJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('eddoorkey').value = document.getElementById('edRepDoor').value;
   <?php

   }

   function edRepIgnitionCodeJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edignition').value = document.getElementById('edRepIgnitionCode').value;
   <?php

   }

   function edRepIntColorJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edintcolor').value = document.getElementById('edRepIntColor').value;
   <?php

   }

   function edRepIntCodeJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edintcode').value = document.getElementById('edRepIntCode').value;
   <?php

   }

   function edRepPcolorJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edpaintcolor').value = document.getElementById('edRepPcolor').value;
   <?php

   }

   function edRepPcodeJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edpaintcode').value = document.getElementById('edRepPcode').value;
   <?php

   }

   function edRepBodyNumJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edBodyNum').value = document.getElementById('edRepBodyNum').value;
   <?php

   }

   function btnEngJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   //document.getElementById('JTDivEngine').Show();
   var veh_id = document.getElementById('hiddenId').value;
   var win_height = 194;
   var win_width = 657;
   var height = window.outerHeight;
   var width = window.outerWidth;
   var top = Math.round((height-win_height)/2);
   var left = Math.round((width-win_width)/2);
   window.open("replace_engine.php?veh_id="+veh_id, 'replace_engine', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
   <?php

   }


   function btnEReplaceClick($sender, $params)
   {
   $result = mysql_query("insert into engine_history_tbl (comp_id,
   veh_id,
   eng_num,
   code,
   power,
   torque,
   disp,
   aircon,
   aspiration,
   cylinder,
   fuel_type)

   values ('".$_SESSION['company_id']."',
   '".$this->hiddenId->getValue()."',
   '".$this->repEngNum->Text."',
   '".$this->repEngCode->Text."',
   '".$this->repEngPower->Text."',
   '".$this->repEngTorque->Text."',
   '".$this->repEngDisp->Text."',
   '".$this->repEngAircon->Text."',
   '".$this->repEngAspiration->Text."',
   '".$this->repEngCylinder->Text."',
   '".$this->repEngFuel->getItemIndex()."')")or die("INSERT ENG HISTORY - " . mysql_error());

   echo "<script type=text/javascript>
        alert('Engine Replaced!');
        document.getElementById('JTDivEngine').Hide();
        </script>";

   }

   function btnECancelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivEngine').Hide();
   <?php

   }

   function repEngCylinderJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edcylinder').value = document.getElementById('repEngCylinder').value;
   <?php

   }

   function repEngAspirationJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edaspiration').value = document.getElementById('repEngAspiration').value;
   <?php

   }

   function repEngAirconJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edAircon').value = document.getElementById('repEngAircon').value;
   <?php

   }

   function repEngDispJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('eddisp').value = document.getElementById('repEngDisp').value;
   <?php

   }

   function repEngTorqueJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edtorque').value = document.getElementById('repEngTorque').value;
   <?php

   }

   function repEngPowerJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edpower').value = document.getElementById('repEngPower').value;
   <?php

   }

   function repEngCodeJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edcode').value = document.getElementById('repEngCode').value;
   <?php

   }

   function repEngNumJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edserialnum').value = document.getElementById('repEngNum').value;
   <?php

   }

   function testJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('edcode').value=document.getElementById('test').value;
   <?php

   }





   function lblattachJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var attachment = document.getElementById('hfAttachment').value;
   //alert(attachment);
   window.open(attachment,"Window1","menubar=no,width=730,height=660,left=350,top=250,toolbar=no");
   <?php

   }



   function btnDelTypeJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var FuelIndex = document.getElementById('listType').selectedIndex;
   var FuelValue = document.getElementById('listType')[FuelIndex].value;
   var comp = document.getElementById('compid').value;
   AjaxFuel3(FuelValue,comp);
   <?php

   }

   function btnAddTypeJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var addfuel = document.getElementById('edType').value;
   var compider = document.getElementById('compid').value;
   AjaxFuel2(addfuel,compider);
   document.Vehicle_Details.edType.value = "";
   <?php

   }


   function btnShowTypeJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivType').Show();
   document.Vehicle_Details.edType.value = "";
   <?php

   }



   function edPremium2JSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPremium2").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPremium2").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edPremium1JSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPremium1").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPremium1").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edOthersSum2JSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edOthersSum2").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edOthersSum2").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);
   <?php

   }

   function edOthersSum1JSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edOthersSum1").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edOthersSum1").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);
   <?php

   }

   function edPrAPAJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPrAOG.value) +
   Number(document.Vehicle_Details.edPrAPA.value);
   <?php

   }

   function edPrAOGJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPrAOG.value) +
   Number(document.Vehicle_Details.edPrAPA.value);
   <?php

   }

   function edPrELPDJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPrELPD").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPrELPD").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edPrELBIJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPrELBI").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPrELBI").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edPrODJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPrOD").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPrOD").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edPrCTPLJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edPrCTPL").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edPrCTPL").value = numero;

   document.Vehicle_Details.edtotPrice.value = Number(document.Vehicle_Details.edPrCTPL.value) +
   Number(document.Vehicle_Details.edPrOD.value) +
   Number(document.Vehicle_Details.edPrELBI.value) +
   Number(document.Vehicle_Details.edPrELPD.value) +
   Number(document.Vehicle_Details.edPremium1.value) +
   Number(document.Vehicle_Details.edPremium2.value);
   <?php

   }

   function edamtAPAJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edamtAOG.value) +
   Number(document.Vehicle_Details.edamtAPA.value);
   <?php

   }

   function edamtAOGJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edamtAOG.value) +
   Number(document.Vehicle_Details.edamtAPA.value);
   <?php

   }

   function edamtELPDJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edamtELPD").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edamtELPD").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);
   <?php

   }

   function edamtELBIJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edamtELBI").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edamtELBI").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);
   <?php

   }

   function edamtODJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edamtOD").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edamtOD").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);
   <?php

   }

   function edamtCTPLJSKeyUp($sender, $params)
   {

   ?>
   //Add your javascript code here
   var numero = document.getElementById("edamtCTPL").value;
       var first = numero.indexOf('.');
       var last = numero.lastIndexOf('.');

       while(isNaN(numero))
       {
        haba = numero.length;
        haba = haba - 1;
        numero = numero.substr(0,haba);
       }

       while(first!=last)
       {
        numero = numero.slice(0,last);
        first = numero.indexOf('.');
        last = numero.lastIndexOf('.');
       }
       document.getElementById("edamtCTPL").value = numero;

   document.Vehicle_Details.edtotAmt.value = Number(document.Vehicle_Details.edamtCTPL.value) +
   Number(document.Vehicle_Details.edamtOD.value) +
   Number(document.Vehicle_Details.edamtELBI.value) +
   Number(document.Vehicle_Details.edamtELPD.value) +
   Number(document.Vehicle_Details.edOthersSum1.value) +
   Number(document.Vehicle_Details.edOthersSum2.value);


   <?php

   }

   function btnDeleteRTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var RTireIndex = document.getElementById('listRTire').selectedIndex;
   var RTireValue = document.getElementById('listRTire')[RTireIndex].value;
   var compider3 = document.getElementById('compid').value;
   AjaxRsize3(RTireValue,compider3);
   <?php

   }

   function btnAddRTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var addrtire = document.getElementById('edRTire').value;
   var compider = document.getElementById('compid').value;
   AjaxRsize2(addrtire,compider);
    document.Vehicle_Details.edRTire.value = "";
   <?php

   }



   function btnDeleteRWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var RwheelIndex = document.getElementById('listRWheel').selectedIndex;
   var RwheelValue = document.getElementById('listRWheel')[RwheelIndex].value;
   var compider3 = document.getElementById('compid').value;
   AjaxRwheel3(RwheelValue,compider3);
   <?php

   }

   function btnAddRWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var addrwheel = document.getElementById('edRWheel').value;
   var compider = document.getElementById('compid').value;
   AjaxRwheel2(addrwheel,compider);
   document.Vehicle_Details.edRWheel.value = "";
   <?php

   }

   function btnAddTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var addtire = document.getElementById('edTire').value;
   var compider = document.getElementById('compid').value;
   AjaxSize2(addtire,compider);
   document.Vehicle_Details.edTire.value = "";
   <?php

   }



   function btnDeleteTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var TireIndex = document.getElementById('listSize').selectedIndex;
   var TireValue = document.getElementById('listSize')[TireIndex].value;
   var compider3 = document.getElementById('compid').value;
   AjaxSize3(TireValue,compider3);
   <?php

   }


   function jtpageVehDetailsShow($sender, $params)
   {
   $this->assignActiveLayer();
   }

   function assignActiveLayer()
   {
    $this->jtpageVehDetails->setTabIndex($this->hiddenTabIndex->getValue());
   }
   function jtpageVehDetailsJSChange($sender, $params)
   {

   ?>
   document.getElementById('hiddenTabIndex').value = document.getElementById('jtpageVehDetails').TabIndex;
   //alert(document.getElementById('hiddenTabIndex').value)
   <?php

   }



   function cmbProvinceJSChange($sender, $params)
   {
   //echo $this->cmbMunicipality->ajaxCall("ProvinceChange");
   ?>
   provinceMunicipality();
   return false;
   <?php

   }

   function cmbRegionJSChange($sender, $params)
   {
   //echo $this->cmbProvince->ajaxCall("RegionChange");
   ?>
   regionProvince();
   return false;
   <?php

   }


   function RegionChange()
       {
       $region_id = $this->cmbRegion->getItemIndex();
       $this->cmbProvince->Clear();
       $this->cmbProvince->AddItem('--Select--', null, null);
       $result_province = mysql_query("select * from lookup_province where region_id='".$region_id."'");

       while($row_province = mysql_fetch_array($result_province))
       {
            $this->cmbProvince->AddItem($row_province['province'], null, $row_province['id']);
       }

       if($region_id==0)
       {
        $this->cmbProvince->Clear();
        $this->cmbMunicipality->Clear();
        $this->cmbProvince->AddItem('--Select Region First--',null,null);
        $this->cmbMunicipality->AddItem('--Select Province First--',null,null);
       }
       }


       function ProvinceChange()
       {
       $region_id = $this->cmbRegion->getItemIndex();
       $this->cmbProvince->Clear();
       $this->cmbProvince->AddItem('--Select--', null, null);
       $result_province = mysql_query("select * from lookup_province where region_id='".$region_id."'");

       while($row_province = mysql_fetch_array($result_province))
       {
            $this->cmbProvince->AddItem($row_province['province'], null, $row_province['id']);
       }

       $province_id = $this->cmbProvince->getItemIndex();
       $this->cmbMunicipality->Clear();
       $this->cmbMunicipality->AddItem('--Select--', null, null);
       $result_municipality = mysql_query("select * from lookup_municipality where province_id='".$province_id."'");

       while($row_municipality = mysql_fetch_array($result_municipality))
       {
            $this->cmbMunicipality->AddItem($row_municipality['municipality'], null, $row_municipality['id']);
       }

       if($province_id==0)
       {
        $this->cmbMunicipality->Clear();
        $this->cmbMunicipality->AddItem('--Select Province First--',null,null);
       }
       }



   function cmbsizeJSChange($sender, $params)
   {
   echo $this->cmbsize->ajaxCall("size");
   ?>
   //Add your javascript code here
   return false;
   <?php

   }


   function btnShowRTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivRTire').Show();
    document.Vehicle_Details.edRTire.value = "";
   <?php

   }

   function btnShowFTireJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivTire').Show();
   document.Vehicle_Details.edTire.value = "";
   <?php

   }


   function btnShowRWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivRWheel').Show();
   document.Vehicle_Details.edRWheel.value = "";
   <?php

   }


   function btnDeleteWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var dropdownIndex = document.getElementById('listWheel').selectedIndex;
   var dropdownValue = document.getElementById('listWheel')[dropdownIndex].value;
   var compider3 = document.getElementById('compid').value;
   AjaxMothercomp3(dropdownValue,compider3);
   <?php

   }


   function btnAddWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   var addwheel = document.getElementById('edAddWheel').value;
   var compider = document.getElementById('compid').value;
   AjaxMothercomp2(addwheel,compider);
   document.Vehicle_Details.edAddWheel.value = "";
   <?php

   }

   function btnShowFWheelJSClick($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.getElementById('JTDivWheel').Show();
   document.Vehicle_Details.edAddWheel.value = "";
   <?php

   }



   function cmbtrackJSChange($sender, $params)
   {
   echo $this->cmbtrack->ajaxCall('cmbtrackChange');
   ?>
   return(false);
   <?php

   }


   function cmbtrackChange($sender, $params)
   {
   $tracking = $this->cmbtrack->getItemIndex();

   if($tracking=='distance')
   {
   $this->lblOd->Caption='Odometer:';
   $this->lblCurrOd->Caption='Curr Odometer:';
   }

   if($tracking=='hours')
   {
   $this->lblOd->Caption='Hours:';
   $this->lblCurrOd->Caption='Curr Hours:';
   }


   }

   function imgBackJSMouseOut($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.images['imgBack'].src="image/btn_back.png"
   <?php

   }

   function imgBackJSMouseOver($sender, $params)
   {

   ?>
   //Add your javascript code here
   document.images['imgBack'].src="image/btn_back2.png"
   <?php

   }



   function btnCancelClick($sender, $params)
   {
    redirect('vehicle_list.php');


   }


   function btnSubmitClick($sender, $params)
   {
      $veh_id = $this->hiddenId->getValue();


      //TRACKING AND UTILIZATION
         /*mysql_query("update vehicle_tbl set
          track_by = '".$this->cmbtrack->getItemIndex()."',
          tracking_value = '" . $this->edodometer->Text. "',
          curr_tracking_value = '" . $this->edCurrOd->Text . "'
          where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE ODOMETER - " . mysql_error());
         */


      //PURCHASE

      $price = $this->edPrice->Text;
      $pur_amt_borrowed = $this->edAmtBorrowedPurchase->Text;
      $pur_interest = $this->edInterestRatePurchase->Text;
      $pur_monthly = $this->edMonthlyPymntPurchase->Text;
      $price_pur = $this->commafy($price);
      $borrowed_pur = $this->commafy($pur_amt_borrowed);
      $interest_pur = $this->commafy($pur_interest);
      $monthly_pur = $this->commafy($pur_monthly);


      $result_purchase = mysql_query("select * from veh_purchase_tbl where vehicle_id='" . $veh_id . "'");
      $purchase_count = mysql_num_rows($result_purchase);
      if($purchase_count == 0)
      {
         mysql_query("insert into veh_purchase_tbl (vehicle_id,
          company_id,
          date,
          price,
          purchase_from,
          address,
          city,
          street,
          country,
          expiration_date,
          comments,
          amt_borrowed,
          interest_rate,
          term_in_years,
          monthly_payment,
          first_pmt_date,
          last_pmt_date,
          lender_name,
          acct_num,
          size,
          other)

          values('" . $this->hiddenId->getValue() . "',
          '".$_SESSION['company_id']."',
          '" . $this->dpPurchase->Text . "',
          '" . $price_pur . "',
          '" . $this->edPurchaseFrm->Text . "',
          '" . $this->edAddressPurchase->Text . "',
          '" . $this->edCityPurchase->Text . "',
          '" . $this->edPStreet->Text . "',
          '" . $this->cmbCountryPur->getItemIndex() . "',
          '" . $this->dpMnfrExpiration->Text . "',
          '" . $this->memoCommentsPurchase->Text . "',
          '" . $borrowed_pur . "',
          '" . $interest_pur . "',
          '" . $this->edTermPurchase->Text . "',
          '" . $monthly_pur . "',
          '" . $this->dpFrstPymntDue->Text . "',
          '" . $this->dpLastPymntDue->Text . "',
          '" . $this->edLenderPurchase->Text . "',
          '" . $this->edAccountNumPurchase->Text . "',
          '".$this->cmbsize->getItemIndex()."',
          '".$this->edother->Text."')")or die("INSERT PURCHASE - " . mysql_error());
          }
         else
         {
         mysql_query("update veh_purchase_tbl set
          vehicle_id = '" . $this->hiddenId->getValue() . "',
          date = '" . $this->dpPurchase->Text . "',
          price = '" . $price_pur . "',
          purchase_from = '" . $this->edPurchaseFrm->Text . "',
          address = '" . $this->edAddressPurchase->Text . "',
          city = '" . $this->edCityPurchase->Text . "',
          street = '".$this->edPStreet->Text."',
          country = '".$this->cmbCountryPur->getItemIndex()."',
          expiration_date = '" . $this->dpMnfrExpiration->Text . "',
          comments = '" . $this->memoCommentsPurchase->Text . "',
          amt_borrowed = '" . $borrowed_pur . "',
          interest_rate = '" . $interest_pur . "',
          term_in_years = '" . $this->edTermPurchase->Text . "',
          monthly_payment = '" . $monthly_pur . "',
          first_pmt_date = '" . $this->dpFrstPymntDue->Text . "',
          last_pmt_date = '" . $this->dpLastPymntDue->Text . "',
          lender_name = '" . $this->edLenderPurchase->Text . "',
          acct_num = '" . $this->edAccountNumPurchase->Text . "',
          size = '".$this->cmbsize->getItemIndex()."',
          other = '".$this->edother->Text."'
          where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE PURCHASE - " . mysql_error());
      }


      //ENGINE/BODY
      $result_engine = mysql_query("select * from veh_engine_tbl where vehicle_id='" .$veh_id. "'");
      $engine_count = mysql_num_rows($result_engine);
      if($engine_count == 0)
      {
      mysql_query("insert into veh_engine_tbl (vehicle_id,
       company_id,
       code,
       serial_num,
       disp_ci,
       aircon_type,
       cylinder,
       power_bhp,
       torque_lb,
       fuel_type,
       aspiration,
       comments1,
       body_num,
       paint_code,
       paint_color,
       interior_code,
       interior_color,
       ignition_code,
       door_key,
       comments2)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->edcode->Text . "',
       '" . $this->edserialnum->Text . "',
       '" . $this->eddisp->Text . "',
       '" . $this->edAircon->Text . "',
       '" . $this->edcylinder->Text . "',
       '" . $this->edpower->Text . "',
       '" . $this->edtorque->Text . "',
       '" . $this->cmbfuel->getItemIndex() . "',
       '" . $this->edaspiration->Text . "',
       '" . $this->memoRemarksEngine->Text . "',
       '" . $this->edBodyNum->Text . "',
       '" . $this->edpaintcode->Text . "',
       '" . $this->edpaintcolor->Text . "',
       '" . $this->edintcode->Text . "',
       '" . $this->edintcolor->Text . "',
       '" . $this->edignition->Text . "',
       '" . $this->eddoorkey->Text . "',
       '" . $this->memoRemarksBody->Text . "')")or die("INSERT ENGINE - " . mysql_error());
      }
      else
      {
      mysql_query("update veh_engine_tbl set
       code = '" . $this->edcode->Text . "',
       serial_num = '" . $this->edserialnum->Text . "',
       disp_ci = '" . $this->eddisp->Text . "',
       aircon_type = '" . $this->edAircon->Text . "',
       cylinder = '" . $this->edcylinder->Text . "',
       power_bhp = '" . $this->edpower->Text . "',
       torque_lb = '" . $this->edtorque->Text . "',
       fuel_type = '" . $this->cmbfuel->getItemIndex() . "',
       aspiration = '" . $this->edaspiration->Text . "',
       comments1 = '" . $this->memoRemarksEngine->Text . "',
       body_num = '".$this->edBodyNum->Text."',
       paint_code = '" . $this->edpaintcode->Text . "',
       paint_color = '" . $this->edpaintcolor->Text . "',
       interior_code = '" . $this->edintcode->Text . "',
       interior_color = '" . $this->edintcolor->Text . "',
       ignition_code = '" . $this->edignition->Text . "',
       door_key = '" . $this->eddoorkey->Text . "',
       comments2 = '" . $this->memoRemarksBody->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE ENGINE - " . mysql_error());
      }


      //WARRANTY
      $result_warranty = mysql_query("select * from veh_warranty_tbl where vehicle_id='" .$veh_id. "'");
      $warranty_count = mysql_num_rows($result_warranty);
      if($warranty_count == 0)
      {
      mysql_query("insert into veh_warranty_tbl(vehicle_id,
       company_id,
       warranty_id,
       validity_date,
       company,
       address,
       city,
       contact_person,
       contact_num,
       cost,
       deductable,
       description,
       notes)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->edWarranty->Text . "',
       '" . $this->dpValidity->Text . "',
       '" . $this->edCompany->Text . "',
       '" . $this->edAddress->Text . "',
       '" . $this->edCity->Text . "',
       '" . $this->edContactPerson->Text . "',
       '" . $this->edPhone->Text . "',
       '" . $this->edCost->Text . "',
       '" . $this->edDeductable->Text . "',
       '" . $this->edDescription->Text . "',
       '" . $this->memoNotes->Text . "')")or die("INSERT WARRANTY - " . mysql_error());
       }
       else
       {
       mysql_query("update veh_warranty_tbl set
       warranty_id = '" . $this->edWarranty->Text . "',
       validity_date = '" . $this->dpValidity->Text . "',
       company = '" . $this->edCompany->Text . "',
       address = '" . $this->edAddress->Text . "',
       city = '" . $this->edCity->Text . "',
       contact_person = '" . $this->edContactPerson->Text . "',
       contact_num = '" . $this->edPhone->Text . "',
       cost = '" . $this->edCost->Text . "',
       deductable = '" . $this->edDeductable->Text . "',
       description = '" . $this->edDescription->Text . "',
       notes = '" . $this->memoNotes->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE WARRANTY - " . mysql_error());
       }


      //INSURANCE
      $tot_coverage = $this->edtotAmt->Text;
      $tot_price = $this->edtotPrice->Text;
      $tot_c = $this->commafy($tot_coverage);
      $tot_p = $this->commafy($tot_price);

      $renew_date = $this->jtdaterenew->Text;
      //die($renew_date);

      $result_insurance = mysql_query("select * from veh_insurance_tbl where vehicle_id='" .$veh_id. "'");
      $insurance_count = mysql_num_rows($result_insurance);
      if($insurance_count == 0)
      {
      mysql_query("insert into veh_insurance_tbl(vehicle_id,
       company_id,
       policy_num,
       company,
       agent,
       category1,
       category2,
       ctpl_amt,
       od_amt,
       elbi_amt,
       elpd_amt,
       other1_amt,
       other2_amt,
       tot_amt,
       ctpl_price,
       od_price,
       elbi_price,
       elpd_price,
       premium1_amt,
       premium2_amt,
       tot_price,
       cover_date,
       renewal_date,
       due_days,
       description)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->edPolicyNum->Text . "',
       '" . $this->edCompInsurance->Text . "',
       '" . $this->edAgentInsurance->Text . "',
       '" . $this->edCat1->Text . "',
       '" . $this->edCat2->Text . "',
       '" . $this->edamtCTPL->Text . "',
       '" . $this->edamtOD->Text . "',
       '" . $this->edamtELBI->Text . "',
       '" . $this->edamtELPD->Text . "',
       '" . $this->edOthersSum1->Text . "',
       '" . $this->edOthersSum2->Text . "',
       '" . $tot_c . "',
       '" . $this->edPrCTPL->Text . "',
       '" . $this->edPrOD->Text . "',
       '" . $this->edPrELBI->Text . "',
       '" . $this->edPrELPD->Text . "',
       '" . $this->edPremium1->Text . "',
       '" . $this->edPremium2->Text . "',
       '" . $tot_p . "',
       '" . $this->jtdatecover->Text . "',
       '" . $this->jtdaterenew->Text . "',
       '".$this->edDue->Text."',
       '".$this->Memo1->Text."')")or die("INSERT INSURANCE - " . mysql_error());

       $result_ins_id = mysql_query("SELECT LAST_INSERT_ID(insurance_id) AS insid FROM veh_insurance_tbl ORDER BY insurance_id DESC LIMIT 0,1") or die("SELECT INS ID - ".mysql_error());
       $row_ins_id = mysql_fetch_array($result_ins_id);
       $ins_id = $row_ins_id['insid'];

       //$renew_date = $this->jtdaterenew->Text;
       if($renew_date!='' && $renew_date!=null && $renew_date!='0000-00-00')
       {
       die($renew_date);
       mysql_query("insert into veh_reminder_tbl (company_id,
       vehicle_id,
       stat_ins_id,
       schedule_by,
       due_date,
       rem_by,
       rem_time,
       completion_window,
       type,
       description,
       status2)

       values('".$_SESSION['company_id']."',
       '".$this->hiddenId->getValue()."',
       '".$ins_id."',
       'Date',
       '".$this->jtdaterenew->Text."',
       'Days',
       '".$this->edDue->Text."',
       'None',
       'Insurance',
       '".$this->Memo1->Text."',
       'Pending')")or die("INSERT REMINDER - " . mysql_error());
       }
       }

       else
       {
       mysql_query("update veh_insurance_tbl set
       policy_num = '" . $this->edPolicyNum->Text . "',
       company = '" . $this->edCompInsurance->Text . "',
       agent = '" . $this->edAgentInsurance->Text . "',
       category1 = '".$this->edCat1->Text."',
       category2 = '".$this->edCat2->Text."',
       ctpl_amt = '".$this->edamtCTPL->Text."',
       od_amt = '".$this->edamtOD->Text."',
       elbi_amt = '".$this->edamtELBI->Text."',
       elpd_amt = '".$this->edamtELPD->Text."',
       other1_amt = '".$this->edOthersSum1->Text."',
       other2_amt = '".$this->edOthersSum2->Text."',
       tot_amt = '".$tot_c."',
       ctpl_price = '".$this->edPrCTPL->Text."',
       od_price = '".$this->edPrOD->Text."',
       elbi_price = '".$this->edPrELBI->Text."',
       elpd_price = '".$this->edPrELPD->Text."',
       premium1_amt = '".$this->edPremium1->Text."',
       premium2_amt = '".$this->edPremium2->Text."',
       tot_price = '".$tot_p."',
       cover_date = '".$this->jtdatecover->Text."',
       renewal_date = '".$this->jtdaterenew->Text."',
       due_days = '".$this->edDue->Text."',
       description = '".$this->Memo1->Text."'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE INSURANCE - " . mysql_error());


       $result_rem = mysql_query("select * from veh_insurance_tbl where vehicle_id='" .$this->hiddenId->getValue(). "'");
       $row_rem = mysql_fetch_array($result_rem);
       $insur_id = $row_rem['insurance_id'];

       $result_reminder = mysql_query("select * from veh_reminder_tbl where vehicle_id='" .$this->hiddenId->getValue(). "' and stat_ins_id='".$insur_id."'");
       $reminder_count = mysql_num_rows($result_reminder);

       if($renew_date!='' && $renew_date!=null && $renew_date!='0000-00-00')
       {
       //die($renew_date);
       if($reminder_count == 0)
       {
       mysql_query("insert into veh_reminder_tbl (company_id,
       vehicle_id,
       stat_ins_id,
       schedule_by,
       due_date,
       rem_by,
       rem_time,
       completion_window,
       type,
       description,
       status2)

       values('".$_SESSION['company_id']."',
       '".$this->hiddenId->getValue()."',
       '".$insur_id."',
       'Date',
       '".$this->jtdaterenew->Text."',
       'Days',
       '".$this->edDue->Text."',
       'None',
       'Insurance',
       '".$this->Memo1->Text."',
       'Pending')")or die("INSERT REMINDER - " . mysql_error());
       }

       if($reminder_count != 0)
       {
       $query_update = "update veh_reminder_tbl set
       due_date = '".$this->jtdaterenew->Text."',
       rem_time = '".$this->edDue->Text."',
       description = '".$this->Memo1->Text."'
       where vehicle_id ='".$this->hiddenId->getValue()."' and stat_ins_id = '".$insur_id."'";
       mysql_query($query_update)or die ("UPDATE INSURANCE REMINDER-".mysql_error());
       }
       }



       }


      //REGISTER/INSPECT
      $result_registration = mysql_query("select * from veh_registration_tbl where vehicle_id='" .$veh_id. "'");
      $registration_count = mysql_num_rows($result_registration);
      if($registration_count == 0)
      {
      mysql_query("insert into veh_registration_tbl(vehicle_id,
       company_id,
       field_office,
       cr_no,
       date,
       file_no,
       plate_no,
       engine_no,
       chassis_no,
       denomination,
       piston_displacement,
       no_cylinders,
       fuel,
       make,
       series,
       body_type,
       body_no,
       year,
       gross_wt,
       net_wt,
       shipping_wt,
       net_capacity,
       owner,
       contact,
       address,
       encumbered_to,
       or_no,
       or_date,
       amt,
       by_register,
       reg_expiration,
       attachment1,
       attachment2)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->edFieldOffice->Text . "',
       '" . $this->edCrNo->Text . "',
       '" . $this->dpDate->Text . "',
       '" . $this->edFileNo->Text . "',
       '" . $this->edPlateNo->Text . "',
       '" . $this->edEngineNo->Text . "',
       '" . $this->edChassisNo->Text . "',
       '" . $this->edDenomination->Text . "',
       '" . $this->edPiston->Text . "',
       '" . $this->edCylinders->Text . "',
       '" . $this->cmbLTOFuel->getItemIndex() . "',
       '" . $this->edMake->Text . "',
       '" . $this->edSeries->Text . "',
       '" . $this->edBodyType->Text . "',
       '" . $this->edBodyNo->Text . "',
       '" . $this->edYear->Text . "',
       '" . $this->edGross->Text . "',
       '" . $this->edNet->Text . "',
       '" . $this->edShipping->Text . "',
       '" . $this->edCapacity->Text . "',
       '" . $this->edOwner->Text . "',
       '" . $this->edContact->Text . "',
       '" . $this->edComAddress->Text . "',
       '" . $this->edEncumbered->Text . "',
       '" . $this->edOrNo->Text . "',
       '" . $this->dpOrDate->Text . "',
       '" . $this->edAmt->Text . "',
       '" . $this->edBy->Text . "',
       '" . $this->dpRegExpiration->Text . "',
       '".$this->uploadFile->FileName."',
       '"."photo/LTO/lto".$this->hiddenId->getValue().".".$this->uploadFile->FileExt."')")or die("INSERT REGISTER/INSPECT - " . mysql_error());

       $this->uploadFile->moveUploadedFile("photo/LTO/lto".$this->hiddenId->getValue().".".$this->uploadFile->FileExt);
       }
       else
       {
       if($this->uploadFile->FileExt=="")
       {
       mysql_query("update veh_registration_tbl set
       field_office = '" . $this->edFieldOffice->Text . "',
       cr_no = '" . $this->edCrNo->Text . "',
       date = '" . $this->dpDate->Text . "',
       file_no = '" . $this->edFileNo->Text . "',
       plate_no = '" . $this->edPlateNo->Text . "',
       engine_no = '" . $this->edEngineNo->Text . "',
       chassis_no = '" . $this->edChassisNo->Text . "',
       denomination = '" . $this->edDenomination->Text . "',
       piston_displacement = '" . $this->edPiston->Text . "',
       no_cylinders = '" . $this->edCylinders->Text . "',
       fuel = '" . $this->cmbLTOFuel->getItemIndex() . "',
       make = '" . $this->edMake->Text . "',
       series = '" . $this->edSeries->Text . "',
       body_type = '" . $this->edBodyType->Text . "',
       body_no = '" . $this->edBodyNo->Text . "',
       year = '" . $this->edYear->Text . "',
       gross_wt = '" . $this->edGross->Text . "',
       net_wt = '" . $this->edNet->Text . "',
       shipping_wt = '" . $this->edShipping->Text . "',
       net_capacity = '" . $this->edCapacity->Text . "',
       owner = '" . $this->edOwner->Text . "',
       contact = '" . $this->edContact->Text . "',
       address = '" . $this->edComAddress->Text . "',
       encumbered_to = '" . $this->edEncumbered->Text . "',
       or_no = '" . $this->edOrNo->Text . "',
       or_date = '" . $this->dpOrDate->Text . "',
       amt = '" . $this->edAmt->Text . "',
       by_register = '" . $this->edBy->Text . "',
       reg_expiration = '" . $this->dpRegExpiration->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE REGISTER/INSPECT - " . mysql_error());
       }

       if($this->uploadFile->FileExt!="")
       {
       mysql_query("update veh_registration_tbl set
       field_office = '" . $this->edFieldOffice->Text . "',
       cr_no = '" . $this->edCrNo->Text . "',
       date = '" . $this->dpDate->Text . "',
       file_no = '" . $this->edFileNo->Text . "',
       plate_no = '" . $this->edPlateNo->Text . "',
       engine_no = '" . $this->edEngineNo->Text . "',
       chassis_no = '" . $this->edChassisNo->Text . "',
       denomination = '" . $this->edDenomination->Text . "',
       piston_displacement = '" . $this->edPiston->Text . "',
       no_cylinders = '" . $this->edCylinders->Text . "',
       fuel = '" . $this->edFuel->Text . "',
       make = '" . $this->edMake->Text . "',
       series = '" . $this->edSeries->Text . "',
       body_type = '" . $this->edBodyType->Text . "',
       body_no = '" . $this->edBodyNo->Text . "',
       year = '" . $this->edYear->Text . "',
       gross_wt = '" . $this->edGross->Text . "',
       net_wt = '" . $this->edNet->Text . "',
       shipping_wt = '" . $this->edShipping->Text . "',
       net_capacity = '" . $this->edCapacity->Text . "',
       owner = '" . $this->edOwner->Text . "',
       contact = '" . $this->edContact->Text . "',
       address = '" . $this->edComAddress->Text . "',
       encumbered_to = '" . $this->edEncumbered->Text . "',
       or_no = '" . $this->edOrNo->Text . "',
       or_date = '" . $this->dpOrDate->Text . "',
       amt = '" . $this->edAmt->Text . "',
       by_register = '" . $this->edBy->Text . "',
       reg_expiration = '" . $this->dpRegExpiration->Text . "',
       attachment1 ='".$this->uploadFile->FileName."',
       attachment2 ='"."photo/LTO/lto".$this->hiddenId->getValue().".".$this->uploadFile->FileExt."'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE REGISTER/INSPECT - " . mysql_error());

       $this->uploadFile->moveUploadedFile("photo/LTO/lto".$this->hiddenId->getValue().".".$this->uploadFile->FileExt);
       }
       }


      //DEPERECIATION

      $dep_amt = $this->edTrade->Text;
      $dep_curr = $this->edCurrentValue->Text;
      $amt_dep = $this->commafy($dep_amt);
      $amt_curr = $this->commafy($dep_curr);

      $result_depreciation = mysql_query("select * from veh_depreciation_tbl where vehicle_id='" .$veh_id. "'");
      $depreciation_count = mysql_num_rows($result_depreciation);
      if($depreciation_count == 0)
      {
      mysql_query("insert into veh_depreciation_tbl(company_id,
       vehicle_id,
       description,
       trade_val,
       tot_period,
       period_remain,
       curr_value,
       dep_per_period)

       values('".$_SESSION['company_id']."',
       '" . $this->hiddenId->getValue() . "',
       '" . $this->edDepDesc->Text . "',
       '" . $amt_dep . "',
       '" . $this->edTotalPeriod->Text . "',
       '" . $this->edPeriod->Text . "',
       '" . $amt_curr . "',
       '" . $this->edDepreciation->Text . "')")or die("INSERT DEPRECIATION - " . mysql_error());
       }
       else
       {
       mysql_query("update veh_depreciation_tbl set
       description = '" . $this->edDepDesc->Text . "',
       trade_val = '" . $amt_dep . "',
       tot_period = '" . $this->edTotalPeriod->Text . "',
       period_remain = '" . $this->edPeriod->Text . "',
       curr_value = '" . $amt_curr . "',
       dep_per_period = '" . $this->edDepreciation->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE DEPRECIATION - " . mysql_error());
       }


      //FLUIDS
      $result_fluids = mysql_query("select * from veh_fluids_tbl where vehicle_id='" .$veh_id. "'");
      $fluids_count = mysql_num_rows($result_fluids);
      if($fluids_count == 0)
      {
      mysql_query("insert into veh_fluids_tbl(company_id,
       vehicle_id,
       oil_type,
       transmission_fluid,
       freon,
       gear_oil,
       fuel_type,
       hydraulic_fluid,
       capacity_oil,
       capacity_transmission,
       capacity_freon,
       capacity_gear,
       capacity_hydraulic,
       capacity_fuel)

       values('".$_SESSION['company_id']."',
       '" . $this->hiddenId->getValue() . "',
       '" . $this->edOilType->Text . "',
       '" . $this->edtransfluid->Text . "',
       '" . $this->edfreon->Text . "',
       '" . $this->edgearoil->Text . "',
       '" . $this->cmbFuelType->getItemIndex()."',
       '" . $this->edhydraulic->Text . "',
       '" . $this->edoilcap->Text . "',
       '" . $this->edtranscap->Text . "',
       '" . $this->edfreoncap->Text . "',
       '" . $this->edgearcap->Text . "',
       '" . $this->edhydraucap->Text . "',
       '" . $this->edFuelCapacity->Text."')")or die("INSERT FLUIDS - " . mysql_error());
       }
       else
       {
       mysql_query("update veh_fluids_tbl set
       oil_type = '" . $this->edOilType->Text . "',
       transmission_fluid = '" . $this->edtransfluid->Text . "',
       freon = '" . $this->edfreon->Text . "',
       gear_oil = '" . $this->edgearoil->Text . "',
       fuel_type = '".$this->cmbFuelType->getItemIndex()."',
       hydraulic_fluid = '" . $this->edhydraulic->Text . "',
       capacity_oil = '" . $this->edoilcap->Text . "',
       capacity_transmission = '" . $this->edtranscap->Text . "',
       capacity_freon = '" . $this->edfreoncap->Text . "',
       capacity_gear = '" . $this->edgearcap->Text . "',
       capacity_hydraulic = '" . $this->edhydraucap->Text . "',
       capacity_fuel = '".$this->edFuelCapacity->Text."'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE FLUIDS - " . mysql_error());
       }



      //GPS
      $result_gps = mysql_query("select * from gps_tbl where vehicle_id='" .$veh_id. "'");
      $gps_count = mysql_num_rows($result_gps);
      if($gps_count == 0)
      {
      mysql_query("insert into gps_tbl(vehicle_id,
       company_id,
       gps_id,
       sim_num,
       device)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->edGpsID->Text . "',
       '" . $this->edSimNum->Text . "',
       '" . $this->edDevice->Text . "')")or die("INSERT GPS - " . mysql_error());
       }
       else
       {
       mysql_query("update gps_tbl set
       gps_id = '" . $this->edGpsID->Text . "',
       sim_num = '" . $this->edSimNum->Text . "',
       device = '" . $this->edDevice->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE GPS - " . mysql_error());
       }


      //DISPOSAL

      $disp_pr = $this->edSellingPriceDisposal->Text;
      $pr_disp = $this->commafy($disp_pr);

      $result_disposal = mysql_query("select * from veh_disposal_tbl where vehicle_id='" .$veh_id. "'");
      $disposal_count = mysql_num_rows($result_disposal);
      if($disposal_count == 0)
      {
      mysql_query("insert into veh_disposal_tbl(vehicle_id,
       company_id,
       sales_date,
       price,
       buyer,
       odometer,
       bldg,
       street,
       city,
       country,
       comments)

       values('" . $this->hiddenId->getValue() . "',
       '".$_SESSION['company_id']."',
       '" . $this->dpRSDateDisposal->Text . "',
       '" . $pr_disp . "',
       '" . $this->edBuyerDisposal->Text . "',
       '" . $this->edOdometerDisposal->Text . "',
       '" . $this->edDisposalBldg->Text . "',
       '" . $this->edStreet->Text . "',
       '" . $this->edDispCity->Text . "',
       '".$this->cmbCountry->getItemIndex()."',
       '" . $this->memoCommentsDisposal->Text . "')")or die("INSERT DISPOSAL - " . mysql_error());
       }
       else
       {
       mysql_query("update veh_disposal_tbl set
       sales_date = '" . $this->dpRSDateDisposal->Text . "',
       price = '" . $pr_disp . "',
       buyer = '" . $this->edBuyerDisposal->Text . "',
       odometer = '" . $this->edOdometerDisposal->Text . "',
       bldg = '" . $this->edDisposalBldg->Text . "',
       street = '".$this->edStreet->Text."',
       city = '".$this->edDispCity->Text."',
       country = '".$this->cmbCountry->getItemIndex()."',
       comments = '" . $this->memoCommentsDisposal->Text . "'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE DISPOSAL - " . mysql_error());
       }

       //CHASSIS
      if ($this->chkL1->Checked==true)
       {
       $chkL1 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L1' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L1','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R1','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL1='0';
       }

       if ($this->chkL2->Checked==true)
       {
       $chkL2 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L3' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L3','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R3','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL2 ='0';
       }

       if ($this->chkL3->Checked==true)
       {
       $chkL3 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L5' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L5','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R5','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL3 ='0';
       }

       if ($this->chkL4->Checked==true)
       {
       $chkL4 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L7' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L7','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R7','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL4 ='0';
       }

       if ($this->chkL5->Checked==true)
       {
       $chkL5 ='1';
	     $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L9' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L9','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R9','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL5 ='0';
       }

       if ($this->chkL6->Checked==true)
       {
       $chkL6 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L11' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L11','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R11','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkL6 ='0';
       }

       if ($this->chkR1->Checked==true)
       {
       $chkR1 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L2' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L2','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R2','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR1 ='0';
       }

       if ($this->chkR2->Checked==true)
       {
       $chkR2 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L4' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L4','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R4','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR2 ='0';
       }

       if ($this->chkR3->Checked==true)
       {
       $chkR3 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L6' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L6','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R6','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR3 ='0';
       }

       if ($this->chkR4->Checked==true)
       {
       $chkR4 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L8' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L8','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R8','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR4 ='0';
       }

       if ($this->chkR5->Checked==true)
       {
       $chkR5 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L10' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L10','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R10','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR5 ='0';
       }

       if ($this->chkR6->Checked==true)
       {
       $chkR6 ='1';
       $reschk = mysql_query("SELECT t_type FROM veh_tire WHERE t_type = 'L12' AND vehicle_id = '".$this->hiddenId->getValue()."'");
       $countchk = mysql_num_rows($reschk);
       if($countchk <= 0)
       {
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('L12','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       mysql_query("insert into veh_tire(t_type,
       is_assigned,
       vehicle_id)
       values('R12','no','".$this->hiddenId->getValue()."')")or die("INSERT VEHICLE TIRE DETAILS - " . mysql_error());
       }
       }
       else
       {
       $chkR6 ='0';
       }

       if ($this->chkLock->Checked==true)
       {
       $chkLock ='1';
       }
       else
       {
       $chkLock='0';
       }

      $result_chassis = mysql_query("select * from veh_chassis_tbl where vehicle_id='" .$veh_id. "'");
      $chassis_count = mysql_num_rows($result_chassis);
      if($chassis_count == 0)
      {
       mysql_query("INSERT INTO veh_chassis_tbl(vehicle_id,
       company_id,
       single_axle1,
       single_axle2,
       single_axle3,
       single_axle4,
       single_axle5,
       single_axle6,
       dual_axle1,
       dual_axle2,
       dual_axle3,
       dual_axle4,
       dual_axle5,
       dual_axle6,
       lock_config,
       axle_type1,
       axle_type2,
       axle_type3,
       axle_type4,
       axle_type5,
       axle_type6,
       diff_type,
       ratio,
       trans_type,
       trans_code,
       fwheel_size,
       ftire_size,
       fpsi,
       rwheel_size,
       rtire_size,
       rpsi,
       remarks)

       VALUES
       ('".$this->hiddenId->getValue()."',
       '".$_SESSION['company_id']."',
       '".$chkL1."',
       '".$chkL2."',
       '".$chkL3."',
       '".$chkL4."',
       '".$chkL5."',
       '".$chkL6."',
       '".$chkR1."',
       '".$chkR2."',
       '".$chkR3."',
       '".$chkR4."',
       '".$chkR5."',
       '".$chkR6."',
       '".$chkLock."',
       '".$this->cmbType1->getItemIndex()."',
       '".$this->cmbType2->getItemIndex()."',
       '".$this->cmbType3->getItemIndex()."',
       '".$this->cmbType4->getItemIndex()."',
       '".$this->cmbType5->getItemIndex()."',
       '".$this->cmbType6->getItemIndex()."',
       '".$this->edDiffType->Text."',
       '".$this->edRatio->Text."',
       '".$this->edTransType->Text."',
       '".$this->edTransCode->Text."',
       '".$this->cmbFrontWheel->getItemIndex()."',
       '".$this->cmbFrontTire->getItemIndex()."',
       '".$this->edFrontPsi->Text."',
       '".$this->cmbRearWheel->getItemIndex()."',
       '".$this->cmbRearTire->getItemIndex()."',
       '".$this->edRearPsi->Text."',
       '".$this->memoRemarks->Text."')") or die("INSERT CHASSIS - ".mysql_error());
       }
       else
       {

       mysql_query("update veh_chassis_tbl set
       single_axle1 ='".$chkL1."',
       single_axle2 ='".$chkL2."',
       single_axle3 ='".$chkL3."',
       single_axle4 ='".$chkL4."',
       single_axle5 ='".$chkL5."',
       single_axle6 = '".$chkL6."',
       dual_axle1 = '".$chkR1."',
       dual_axle2 = '".$chkR2."',
       dual_axle3 = '".$chkR3."',
       dual_axle4 = '".$chkR4."',
       dual_axle5 = '".$chkR5."',
       dual_axle6 = '".$chkR6."',
       lock_config = '".$chkLock."',
       axle_type1 = '".$this->cmbType1->getItemIndex()."',
       axle_type2 = '".$this->cmbType2->getItemIndex()."',
       axle_type3 = '".$this->cmbType3->getItemIndex()."',
       axle_type4 = '".$this->cmbType4->getItemIndex()."',
       axle_type5 = '".$this->cmbType5->getItemIndex()."',
       axle_type6 = '".$this->cmbType6->getItemIndex()."',
       diff_type = '".$this->edDiffType->Text."',
       ratio = '".$this->edRatio->Text."',
       trans_type = '".$this->edTransType->Text."',
       trans_code = '".$this->edTransCode->Text."',
       fwheel_size = '".$this->cmbFrontWheel->getItemIndex()."',
       ftire_size = '".$this->cmbFrontTire->getItemIndex()."',
       fpsi = '".$this->edFrontPsi->Text."',
       rwheel_size = '".$this->cmbRearWheel->getItemIndex()."',
       rtire_size = '".$this->cmbRearTire->getItemIndex()."',
       rpsi = '".$this->edRearPsi->Text."',
       remarks = '".$this->memoRemarks->Text."'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE CHASSIS - " . mysql_error());
       }

       //OTHER DETAILS
       if ($this->chkFleet->Checked==true)
       {
       $chkFleet ='1';
       }
       else
       {
       $chkFleet='0';
       }

 $result_other = mysql_query("select * from veh_other_details_tbl where vehicle_id='" .$veh_id. "'");
      $other_count = mysql_num_rows($result_other);
      if($other_count == 0)
      {
       mysql_query("INSERT INTO veh_other_details_tbl(vehicle_id,
       company_id,
       fleet_card,
       band,
       id_no,
       benefit_plan,
       cost_center,
       group1,
       division,
       section,
       ref_po,
       asset_no,
       equipt_no)



       VALUES
       ('".$this->hiddenId->getValue()."',
       '".$_SESSION['company_id']."',
       '".$chkFleet."',
       '".$this->cmbBand->getItemIndex()."',
       '".$this->edIdNo->Text."',
       '".$this->edBenefitPlan->Text."',
       '".$this->edCostCenter->Text."',
       '".$this->edGroup->Text."',
       '".$this->edDivision->Text."',
       '".$this->edSection->Text."',
       '".$this->edRefPO->Text."',
       '".$this->edAssetNo->Text."',
       '".$this->edEquiptNo->Text."')") or die("INSERT OTHER - ".mysql_error());
       }

       else
       {

       mysql_query("update veh_other_details_tbl set
       fleet_card ='".$chkFleet."',
       band = '".$this->cmbBand->getItemIndex()."',
       id_no = '".$this->edIdNo->Text."',
       benefit_plan = '".$this->edBenefitPlan->Text."',
       cost_center = '".$this->edCostCenter->Text."',
       group1 = '".$this->edGroup->Text."',
       division = '".$this->edDivision->Text."',
       section = '".$this->edSection->Text."',
       ref_po = '".$this->edRefPO->Text."',
       asset_no = '".$this->edAssetNo->Text."',
       equipt_no = '".$this->edEquiptNo->Text."'
       where vehicle_id='" . $this->hiddenId->getValue() . "'")or die("UPDATE OTHER - " . mysql_error());
       }

       redirect('vehicle_list.php');
       }


      function commafy($_)
       {
        return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,' , strrev( $_ ) ) );
       }



      function Vehicle_DetailsCreate($sender, $params)
      {
      $this->compid->Value = $_SESSION['company_id'];
      $id = $_GET['veh'];
      if($id!=''||$id!=null)
      $this->hiddenId->setValue($id);

      $this->jtpageVehDetails->setTabIndex(0);

      if($_SESSION['access_vehicle']==1)
       {
       $this->btnCancel->Visible=false;
       $this->btnSubmit->Visible=false;
       }

       if($_SESSION['access_vehicle']==2)
       {
       $this->btnCancel->Visible=true;
       $this->btnSubmit->Visible=true;
       }

      $this->cmbfuel->Clear();
      $result_fuel = mysql_query("select * from lookup_fuel_tbl where company_id = '".$_SESSION['company_id']."' AND category='octane/Types'");

      while($row_fuel = mysql_fetch_array($result_fuel))
      {
        $this->cmbfuel->AddItem($row_fuel['value'], null, $row_fuel['id']);
      }

      //list fuel
      $this->listType->Clear();
      $result_f = mysql_query("select * from lookup_fuel_tbl where company_id = '".$_SESSION['company_id']."' AND category='octane/Types'");

      while($row_f = mysql_fetch_array($result_f))
      {
        $this->listType->AddItem($row_f['value'], null, $row_f['id']);
      }

      $query_veh_dec = "select * from vehicle_tbl where vehicle_id='".$this->hiddenId->getValue()."'";
      $result_veh_dec = mysql_query($query_veh_dec)or die("SELECT VEH DEC - " . mysql_error());;
      $row_veh_dec = mysql_fetch_array($result_veh_dec);
      $out_of_service = $row_veh_dec['out_of_service'];

      $this->imgBack->setLink('vehicle_list.php?company_id='.$_SESSION['company_id']);
      $this->imageAddEmission->setLink('veh_emission_create.php?veh='.$this->hiddenId->getValue());
      $this->imageAddSpecification->setLink('veh_specification_create.php?veh='.$this->hiddenId->getValue());
      $this->imageAddJournal->setLink('veh_journal_create.php?veh='.$this->hiddenId->getValue());


      /*$result_od = mysql_query("select * from vehicle_tbl where vehicle_id='".$this->hiddenId->getValue()."'");
      $row_od = mysql_fetch_array($result_od);
      $label_od = $row_od['track_by'];
      if ($label_od=='distance')
      {
        $this->lblOd->Caption = 'Odometer:';
      }
      else
      {
        $this->lblOd->Caption = 'Curr hours:';
      } */


      $result_vin = mysql_query("SELECT * FROM vehicle_tbl WHERE vehicle_id='" .$this->hiddenId->getValue(). "'");
      $row_selected = mysql_fetch_array($result_vin);
      $label = $row_selected['VIN'];
      $this->lblVeh->Caption = $label;
      $this->lblyear->Caption = $row_selected['year'];
      $this->lblmake->Caption = $row_selected['manufacturer_name'];
      $this->lblmodel->Caption = $row_selected['model_name'];
      $this->lblplate->Caption = $row_selected['veh_num'];
      $this->edChassis->Text = $row_selected['chassis_num'];

      //TRACKING AND UTILIZATION

      /*$track_by = $this->cmbtrack->ItemIndex = $row_selected['tracking_by'];
      if($track_by=='distance')
      {
      $this->lblOd->Caption='Odometer:';
      $this->lblCurrOd->Caption='Curr Odometer';
      }

      if($track_by=='hours')
      {
      $this->lblOd->Caption='Hours:';
      $this->lblCurrOd->Caption='Curr Hours:';
      }
      $this->edodometer->Text = $row_selected['tracking_value'];
      $this->edCurrOd->Text = $row_selected['curr_tracking_value'];*/




      //PURCHASE
      $query_purchase = "select * from veh_purchase_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_purchase_show = mysql_query($query_purchase)or die("SELECT PURCHASE - " . mysql_error());
      $row_purchase = mysql_fetch_array($result_purchase_show);

      $this->dpPurchase->Text = $row_purchase['date'];
      $this->edPrice->Text = $row_purchase['price'];
      $this->edPurchaseFrm->Text = $row_purchase['purchase_from'];
      $this->edAddressPurchase->Text = $row_purchase['address'];
      $this->edPStreet->Text = $row_purchase['street'];
      $this->edCityPurchase->Text = $row_purchase['city'];
      //$this->edOdometerPurchase->Text = $row_purchase['odometer'];
      $this->dpMnfrExpiration->Text = $row_purchase['expiration_date'];
      $this->memoCommentsPurchase->Text = $row_purchase['comments'];
      $this->edAmtBorrowedPurchase->Text = $row_purchase['amt_borrowed'];
      $this->edInterestRatePurchase->Text = $row_purchase['interest_rate'];
      $this->edTermPurchase->Text = $row_purchase['term_in_years'];
      $this->edMonthlyPymntPurchase->Text = $row_purchase['monthly_payment'];
      $this->dpFrstPymntDue->Text = $row_purchase['first_pmt_date'];
      $this->dpLastPymntDue->Text = $row_purchase['last_pmt_date'];
      $this->edLenderPurchase->Text = $row_purchase['lender_name'];
      $this->edAccountNumPurchase->Text = $row_purchase['acct_num'];
      $this->edother->Text = $row_purchase['other'];
      $this->cmbsize->ItemIndex = $row_purchase['size'];

      $this->cmbCountryPur->Clear();
      if($row_purchase['country']=='')
      $this->cmbCountryPur->ItemIndex = 'Philippines';
      if($row_purchase['country']!='')
      $this->cmbCountryPur->ItemIndex = $row_purchase['country'];
       $query_country = "SELECT country FROM countries";
       $result_country = mysql_query($query_country) or die("SELECT COUNTRIES ".mysql_error());
       while($row_country = mysql_fetch_array($result_country))
       {
        $country = $row_country['country'];
        $this->cmbCountryPur->AddItem($country, '', $country);
       }

      $size = $row_purchase['size'];
      if($size=='other')
      {
      $this->edother->Enabled=true;
      }

      if($size!='other')
      {
      $this->edother->Text='';
      $this->edother->Enabled=false;
      }


      //ENGINE/BODY
      $this->edRepBodyNum->Text = '';
      $this->edRepPcode->Text = '';
      $this->edRepPcolor->Text = '';
      $this->edRepIntCode->Text = '';
      $this->edRepIntColor->Text = '';
      $this->edRepIgnitionCode->Text = '';
      $this->edRepDoor->Text = '';

      $this->repEngNum->Text = '';
      $this->repEngCode->Text = '';
      $this->repEngPower->Text = '';
      $this->repEngTorque->Text = '';
      $this->repEngDisp->Text = '';
      $this->repEngAircon->Text = '';
      $this->repEngAspiration->Text = '';
      $this->repEngCylinder->Text = '';

      $query_engine = "select * from veh_engine_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_engine_show = mysql_query($query_engine)or die("SELECT ENGINE - " . mysql_error());
      $row_engine = mysql_fetch_array($result_engine_show);

      $this->edcode->Text = $row_engine['code'];
      $this->edserialnum->Text = $row_selected['engine_model'];
      $this->eddisp->Text = $row_engine['disp_ci'];
      $this->edAircon->Text = $row_engine['aircon_type'];
      $this->edcylinder->Text = $row_engine['cylinder'];
      $this->edpower->Text = $row_engine['power_bhp'];
      $this->edtorque->Text = $row_engine['torque_lb'];
      $this->edaspiration->Text = $row_engine['aspiration'];
      $this->memoRemarksEngine->Text = $row_engine['comments1'];
      $this->edpaintcode->Text = $row_engine['paint_code'];
      $this->edpaintcolor->Text = $row_engine['paint_color'];
      $this->edintcode->Text = $row_engine['interior_code'];
      $this->edintcolor->Text = $row_engine['interior_color'];
      $this->edignition->Text = $row_engine['ignition_code'];
      $this->eddoorkey->Text = $row_engine['door_key'];
      $this->memoRemarksBody->Text = $row_engine['comments2'];
      $this->cmbfuel->setItemIndex($row_engine['fuel_type']);

      //WARRANTY
      $query_warranty = "select * from veh_warranty_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_warranty_show = mysql_query($query_warranty)or die("SELECT WARRANTY - " . mysql_error());
      $row_warranty = mysql_fetch_array($result_warranty_show);

      $this->edWarranty->Text = $row_warranty['warranty_id'];
      $this->dpValidity->Text = $row_warranty['validity_date'];
      $this->edCompany->Text = $row_warranty['company'];
      $this->edAddress->Text = $row_warranty['address'];
      $this->edCity->Text = $row_warranty['city'];
      $this->edContactPerson->Text = $row_warranty['contact_person'];
      $this->edPhone->Text = $row_warranty['contact_num'];
      $this->edCost->Text = $row_warranty['cost'];
      $this->edDeductable->Text = $row_warranty['deductable'];
      $this->edDescription->Text = $row_warranty['description'];
      $this->memoNotes->Text = $row_warranty['notes'];


      //INSURANCE
      //$ins_id = rand();

      $query_insurance = "select * from veh_insurance_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_insurance_show = mysql_query($query_insurance)or die("SELECT INSURANCE - " . mysql_error());
      $row_insurance = mysql_fetch_array($result_insurance_show);

      $ctpl = $row_insurance['ctpl_amt'];
      $od = $row_insurance['od_amt'];
      $elbi = $row_insurance['elbi_amt'];
      $elpd = $row_insurance['elpd_amt'];
      $cat1 = $row_insurance['category1'];
      $cat2 = $row_insurance['category2'];
      $other1 = $row_insurance['other1_amt'];
      $other2 = $row_insurance['other2_amt'];
      $premium1 = $row_insurance['premium1_amt'];
      $premium2 = $row_insurance['premium2_amt'];
      //$rand_id = $row_insurance['rand_id'];

      $this->edDue->Text = $row_insurance['due_days'];
      $this->edPolicyNum->Text = $row_insurance['policy_num'];
      $this->edCompInsurance->Text = $row_insurance['company'];
      $this->edAgentInsurance->Text = $row_insurance['agent'];
      $this->edamtCTPL->Text = $ctpl;
      $this->edamtOD->Text = $od;
      $this->edamtELBI->Text = $elbi;
      $this->edamtELPD->Text = $elpd;
      $this->edCat1->Text = $cat1;
      $this->edCat2->Text = $cat2;
      $this->edOthersSum1->Text = $other1;
      $this->edOthersSum2->Text = $other2;
      $this->edPremium1->Text = $premium1;
      $this->edPremium2->Text = $premium2;
      $this->edtotAmt->Text = $row_insurance['tot_amt'];
      $this->edPrCTPL->Text = $row_insurance['ctpl_price'];
      $this->edPrOD->Text = $row_insurance['od_price'];
      $this->edPrELBI->Text = $row_insurance['elbi_price'];
      $this->edPrELPD->Text = $row_insurance['elpd_price'];
      $this->edtotPrice->Text = $row_insurance['tot_price'];
      $this->jtdatecover->Text = $row_insurance['cover_date'];
      $this->jtdaterenew->Text = $row_insurance['renewal_date'];


      //DEPRECIATION
      $query_depreciation = "select * from veh_depreciation_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_depreciation_show = mysql_query($query_depreciation)or die("SELECT DEPRECIATION - " . mysql_error());
      $row_depreciation = mysql_fetch_array($result_depreciation_show);

      $this->edDepDesc->Text = $row_depreciation['description'];
      $this->edTrade->Text = $row_depreciation['trade_val'];
      $this->edTotalPeriod->Text = $row_depreciation['tot_period'];
      $this->edPeriod->Text = $row_depreciation['period_remain'];
      $this->edCurrentValue->Text = $row_depreciation['curr_value'];
      $this->edDepreciation->Text = $row_depreciation['dep_per_period'];



      //FLUIDS
      $query_fluids = "select * from veh_fluids_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_fluids_show = mysql_query($query_fluids)or die("SELECT FLUIDS - " . mysql_error());
      $row_fluids = mysql_fetch_array($result_fluids_show);

      $this->edOilType->Text = $row_fluids['oil_type'];
      $this->edtransfluid->Text = $row_fluids['transmission_fluid'];
      $this->edfreon->Text = $row_fluids['freon'];
      $this->edgearoil->Text = $row_fluids['gear_oil'];
      $this->edhydraulic->Text = $row_fluids['hydraulic_fluid'];
      $this->edoilcap->Text = $row_fluids['capacity_oil'];
      $this->edtranscap->Text = $row_fluids['capacity_transmission'];
      $this->edfreoncap->Text = $row_fluids['capacity_freon'];
      $this->edgearcap->Text = $row_fluids['capacity_gear'];
      $this->edhydraucap->Text = $row_fluids['capacity_hydraulic'];
      $this->edFuelCapacity->Text = $row_fluids['capacity_fuel'];

      $this->cmbFuelType->Clear();
      $this->cmbFuelType->ItemIndex=$row_fluids['fuel_type'];
        $result_ftype = mysql_query("select * from lookup_fuel_tbl where company_id='".$_SESSION['company_id']."' AND category='octane/Types'");

        while($row_ftype = mysql_fetch_array($result_ftype))
        {
            $this->cmbFuelType->AddItem($row_ftype['value'], null, $row_ftype['id']);
        }


      //REGISTER/INSPECT
      $query_registration = "select * from veh_registration_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_registration_show = mysql_query($query_registration)or die("SELECT REGISTRATION - " . mysql_error());
      $row_registration = mysql_fetch_array($result_registration_show);

      $this->edFieldOffice->Text = $row_registration['field_office'];
      $this->edCrNo->Text = $row_registration['cr_no'];
      $this->dpDate->Text = $row_registration['date'];
      $this->edFileNo->Text = $row_registration['file_no'];
      $this->edPlateNo->Text = $row_registration['plate_no'];
      $this->edEngineNo->Text = $row_registration['engine_no'];
      $this->edChassisNo->Text = $row_registration['chassis_no'];
      $this->edDenomination->Text = $row_registration['denomination'];
      $this->edPiston->Text = $row_registration['piston_displacement'];
      $this->edCylinders->Text = $row_registration['no_cylinders'];
      //$this->edFuel->Text = $row_registration['fuel'];
      $this->edMake->Text = $row_registration['make'];
      $this->edSeries->Text = $row_registration['series'];
      $this->edBodyType->Text = $row_registration['body_type'];
      $this->edBodyNo->Text = $row_registration['body_no'];
      $this->edYear->Text = $row_registration['year'];
      $this->edGross->Text = $row_registration['gross_wt'];
      $this->edNet->Text = $row_registration['net_wt'];
      $this->edShipping->Text = $row_registration['shipping_wt'];
      $this->edCapacity->Text = $row_registration['net_capacity'];
      $this->edOwner->Text = $row_registration['owner'];
      $this->edContact->Text = $row_registration['contact'];
      $this->edComAddress->Text = $row_registration['address'];
      $this->edEncumbered->Text = $row_registration['encumbered_to'];
      $this->edOrNo->Text = $row_registration['or_no'];
      $this->dpOrDate->Text = $row_registration['or_date'];
      $this->edAmt->Text = $row_registration['amt'];
      $this->edBy->Text = $row_registration['by_register'];
      $this->dpRegExpiration->Text = $row_registration['reg_expiration'];

       $this->lblattach->Caption = $row_registration['attachment1'];
       $this->hfAttachment->setValue($row_registration['attachment2']);
       $this->lblattach->Font->Color='blue';

      $this->cmbLTOFuel->Clear();
      $this->cmbLTOFuel->ItemIndex = $row_registration['fuel'];
      $result_fuel = mysql_query("select * from lookup_fuel_tbl where company_id = '".$_SESSION['company_id']."' AND category='octane/Types'");

      while($row_fuel = mysql_fetch_array($result_fuel))
      {
        $this->cmbLTOFuel->AddItem($row_fuel['value'], null, $row_fuel['id']);
      }

      $query_veh = "select * from vehicle_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_veh_show = mysql_query($query_veh)or die("SELECT VEH - " . mysql_error());
      $row_veh = mysql_fetch_array($result_veh_show);

      $this->edPlateNo->Text = $row_veh['veh_num'];
      $this->edChassisNo->Text = $row_veh['chassis_num'];
      $this->edEngineNo->Text = $row_veh['engine_model'];
      $this->edYear->Text = $row_veh['year'];
      $this->edMake->Text = $row_veh['manufacturer_name'];
      $this->edSeries->Text = $row_veh['model_name'];
      $this->edBodyType->Text = $row_veh['style_name'];

      $query_eng = "select * from veh_engine_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_eng_show = mysql_query($query_eng)or die("SELECT ENG - " . mysql_error());
      $row_eng = mysql_fetch_array($result_eng_show);

      $this->edFuel->Text = $row_eng['fuel_type'];
      $this->edCylinders->Text = $row_eng['cylinder'];

      //GPS
      $query_gps = "select * from gps_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_gps_show = mysql_query($query_gps)or die("SELECT GPS - " . mysql_error());
      $row_gps = mysql_fetch_array($result_gps_show);

      $this->edGpsID->Text = $row_gps['gps_id'];
      $this->edSimNum->Text = $row_gps['sim_num'];
      $this->edDevice->Text = $row_gps['device'];


      //DISPOSAL

      $query_disposal = "select * from veh_disposal_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_disposal_show = mysql_query($query_disposal)or die("SELECT DISPOSAL - " . mysql_error());
      $row_disposal = mysql_fetch_array($result_disposal_show);

      $this->dpRSDateDisposal->Text = $row_disposal['sales_date'];
      $this->edSellingPriceDisposal->Text = $row_disposal['price'];
      $this->edBuyerDisposal->Text = $row_disposal['buyer'];
      $this->edOdometerDisposal->Text = $row_disposal['odometer'];
      $this->edDisposalAddress->Text = $row_disposal['address'];
      $this->memoCommentsDisposal->Text = $row_disposal['comments'];

      $this->edDisposalBldg->Text = $row_disposal['bldg'];
      $this->edStreet->Text = $row_disposal['street'];
      $this->edDispCity->Text = $row_disposal['city'];

      $this->cmbCountry->Clear();
      if($row_disposal['country']=='')
      $this->cmbCountry->ItemIndex = 'Philippines';
      if($row_disposal['country']!='')
      $this->cmbCountry->ItemIndex = $row_disposal['country'];
      $result_country = mysql_query("select * from countries order by country ASC");

      while($row_country = mysql_fetch_array($result_country))
      {
          $this->cmbCountry->AddItem($row_country['country'], null, $row_country['country']);
      }


      //Disposal Region,Prov, Municipality

      $this->cmbRegion->Clear();
      $this->cmbRegion->AddItem('--Select--', null, null);
      $this->cmbRegion->ItemIndex=$row_disposal['region'];
      $result_vend_region = mysql_query("select * from lookup_region");

      while($row_vend_region = mysql_fetch_array($result_vend_region))
        {
          $this->cmbRegion->AddItem($row_vend_region['region'], null, $row_vend_region['id']);
        }

      $region_id = $row_disposal['region'];
      $this->cmbProvince->Clear();
      $this->cmbProvince->AddItem('--Select--', null, null);
      $result_province = mysql_query("select * from lookup_province where region_id='".$region_id."'");

      while($row_province = mysql_fetch_array($result_province))
       {
          $this->cmbProvince->AddItem($row_province['province'], null, $row_province['id']);
       }

       $province_id = $row_disposal['province'];
       $this->cmbMunicipality->Clear();
       $this->cmbMunicipality->AddItem('--Select--', null, null);
       $result_municipality = mysql_query("select * from lookup_municipality where province_id='".$province_id."'");

       while($row_municipality = mysql_fetch_array($result_municipality))
       {
            $this->cmbMunicipality->AddItem($row_municipality['municipality'], null, $row_municipality['id']);
       }
        $this->cmbProvince->setItemIndex($row_disposal['province']);
        $this->cmbMunicipality->setItemIndex($row_disposal['municipality']);






      //CHASSIS
      $this->lblLock->Visible = False;
      $this->chkLock->Hidden = True;
      $this->chkR1->Visible = False;
      $this->chkHidden1->Visible = False;
      $this->imgNoTire1->ImageSource='image/notire.png';
      $this->imgNoTire2->ImageSource='image/notire.png';
      $this->imgNoTire3->ImageSource='image/notire.png';
      $this->imgNoTire4->ImageSource='image/notire.png';
      $this->imgNoTire5->ImageSource='image/notire.png';
      $this->imgNoTire6->ImageSource='image/notire.png';

      $query_chassis = "select * from veh_chassis_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_chassis_show = mysql_query($query_chassis)or die("SELECT CHASSIS - " . mysql_error());
      $row_chassis = mysql_fetch_array($result_chassis_show);

      if($row_chassis['single_axle1']=='1')
      {
      $this->chkL1->Checked=true;
      $this->imgNoTire1->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL1->Checked=false;
      }

      if($row_chassis['single_axle2']=='1')
      {
      $this->chkL2->Checked=true;
      $this->imgNoTire2->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL2->Checked=false;
      }

      if($row_chassis['single_axle3']=='1')
      {
      $this->chkL3->Checked=true;
      $this->imgNoTire3->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL3->Checked=false;
      }

      if($row_chassis['single_axle4']=='1')
      {
      $this->chkL4->Checked=true;
      $this->imgNoTire4->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL4->Checked=false;
      }

      if($row_chassis['single_axle5']=='1')
      {
      $this->chkL5->Checked=true;
      $this->imgNoTire5->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL5->Checked=false;
      }

      if($row_chassis['single_axle6']=='1')
      {
      $this->chkL6->Checked=true;
      $this->imgNoTire6->ImageSource='image/tire1.jpg';
      }
      else
      {
      $this->chkL6->Checked=false;
      }

      if($row_chassis['dual_axle1']=='1')
      {
      $this->chkR1->Checked=true;
      $this->imgNoTire1->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR1->Checked=false;
      }

      if($row_chassis['dual_axle2']=='1')
      {
      $this->chkR2->Checked=true;
      $this->imgNoTire2->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR2->Checked=false;
      }

      if($row_chassis['dual_axle3']=='1')
      {
      $this->chkR3->Checked=true;
      $this->imgNoTire3->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR3->Checked=false;
      }

      if($row_chassis['dual_axle4']=='1')
      {
      $this->chkR4->Checked=true;
      $this->imgNoTire4->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR4->Checked=false;
      }

      if($row_chassis['dual_axle5']=='1')
      {
      $this->chkR5->Checked=true;
      $this->imgNoTire5->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR5->Checked=false;
      }

      if($row_chassis['dual_axle6']=='1')
      {
      $this->chkR6->Checked=true;
      $this->imgNoTire6->ImageSource='image/tire2.jpg';
      }
      else
      {
      $this->chkR6->Checked=false;
      }

      if($row_chassis['lock_config']=='1')
      {
      $this->chkLock->Checked=true;
      }
      else
      {
      $this->chkLock->Checked=false;
      }

      $this->edDiffType->Text = $row_chassis['diff_type'];
      $this->edRatio->Text = $row_chassis['ratio'];
      $this->edTransType->Text = $row_chassis['trans_type'];
      $this->edTransCode->Text = $row_chassis['trans_code'];
      $this->edFrontPsi->Text = $row_chassis['fpsi'];
      $this->edRearPsi->Text = $row_chassis['rpsi'];
      $this->memoRemarks->Text = $row_chassis['remarks'];

      $this->cmbType1->ItemIndex = $row_chassis['axle_type1'];
      $this->cmbType2->ItemIndex = $row_chassis['axle_type2'];
      $this->cmbType3->ItemIndex = $row_chassis['axle_type3'];
      $this->cmbType4->ItemIndex = $row_chassis['axle_type4'];
      $this->cmbType5->ItemIndex = $row_chassis['axle_type5'];
      $this->cmbType6->ItemIndex = $row_chassis['axle_type6'];

      $this->cmbFrontWheel->ItemIndex = $row_chassis['fwheel_size'];
      $this->cmbFrontWheel->Clear();
      $result_fwheel = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='wheel sizes'");

      while($row_fwheel = mysql_fetch_array($result_fwheel))
      {
      $this->cmbFrontWheel->AddItem($row_fwheel['value'], null, $row_fwheel['id']);
      }

      $this->cmbFrontTire->ItemIndex = $row_chassis['ftire_size'];
      $this->cmbFrontTire->Clear();
      $result_ftire = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='sizes'");

      while($row_ftire = mysql_fetch_array($result_ftire))
      {
      $this->cmbFrontTire->AddItem($row_ftire['value'], null, $row_ftire['id']);
      }

      $this->cmbRearWheel->ItemIndex = $row_chassis['rwheel_size'];
      $this->cmbRearWheel->Clear();
      $result_rwheel = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='wheel sizes'");

      while($row_rwheel = mysql_fetch_array($result_rwheel))
      {
      $this->cmbRearWheel->AddItem($row_rwheel['value'], null, $row_rwheel['id']);
      }

      $this->cmbRearTire->ItemIndex = $row_chassis['rtire_size'];
      $this->cmbRearTire->Clear();
      $result_rtire = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='sizes'");

      while($row_rtire = mysql_fetch_array($result_rtire))
      {
      $this->cmbRearTire->AddItem($row_rtire['value'], null, $row_rtire['id']);
      }

      $query_cha = "select * from vehicle_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_cha_show = mysql_query($query_cha)or die("SELECT CHA - " . mysql_error());
      $row_cha = mysql_fetch_array($result_cha_show);

      $this->edChassis->Text = $row_cha['chassis_num'];

      //  --listbox--
       $this->listWheel->Clear();
       $result_wheel = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='wheel sizes'");


        while($row_wheel = mysql_fetch_array($result_wheel))
        {
            $this->listWheel->AddItem($row_wheel['value'], null, $row_wheel['id']);
        }


       $this->listSize->Clear();
       $result_size = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='sizes'");


        while($row_size = mysql_fetch_array($result_size))
        {
            $this->listSize->AddItem($row_size['value'], null, $row_size['id']);
        }


       $this->listRWheel->Clear();
       $result_rwheel = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='wheel sizes'");


        while($row_rwheel = mysql_fetch_array($result_rwheel))
        {
            $this->listRWheel->AddItem($row_rwheel['value'], null, $row_rwheel['id']);
        }

        $this->listRTire->Clear();
       $result_rtire = mysql_query("select * from lookup_tire_tbl where company_id='".$_SESSION['company_id']."' AND category='sizes'");


        while($row_rtire = mysql_fetch_array($result_rtire))
        {
            $this->listRTire->AddItem($row_rtire['value'], null, $row_rtire['id']);
        }

       //OTHER DETAILS
      $query_other = "select * from veh_other_details_tbl where vehicle_id= '" .$this->hiddenId->getValue(). "'";
      $result_other_show = mysql_query($query_other)or die("SELECT OTHER - " . mysql_error());
      $row_other = mysql_fetch_array($result_other_show);

      if($row_other['fleet_card']=='1')
      {
      $this->chkFleet->Checked=true;
      }
      else
      {
      $this->chkFleet->Checked=false;
      }

      $this->cmbBand->ItemIndex = $row_other['band'];
      $this->edIdNo->Text = $row_other['id_no'];
      $this->edBenefitPlan->Text = $row_other['benefit_plan'];
      $this->edCostCenter->Text = $row_other['cost_center'];
      $this->edGroup->Text = $row_other['group1'];
      $this->edDivision->Text = $row_other['division'];
      $this->edSection->Text = $row_other['section'];
      $this->edRefPO->Text = $row_other['ref_po'];
      $this->edAssetNo->Text = $row_other['asset_no'];
      $this->edEquiptNo->Text = $row_other['equipt_no'];

      $this->imgBack->setLink('vehicle_list.php?company_id='.$_SESSION['company_id']);


      }


       function size()
      {
       $size = $this->cmbsize->getItemIndex();

       if($size=='other')
       {
       $this->edother->Enabled=true;
       }

       if($size!='other')
       {
       $this->edother->Enabled=false;
       }
      }





       function JTPlatinumGrid3Show($sender, $params)
       {
       $query2 = "select * from veh_specification_tbl where vehicle_id='".$this->hiddenId->getValue()."'";
       $result2 = mysql_query($query2)or die(mysql_error());

       $arr = array();
       while($row = mysql_fetch_array($result2))
       {
         $description = "<a href=veh_specification_edit.php?veh=".$this->hiddenId->getValue()."&specification=".$row['specification_id'].">".$row['description']."</a>";
         $arr[] = array(
                        'Description' => $description,
                        'Value/Qty' => $row['quantity']
                        );

       }

       $this->JTPlatinumGrid3->setCellData($arr);


       }

       function JTPlatinumGrid2Show($sender, $params)
       {
       $query1 = "select * from veh_journal_tbl where vehicle_id='".$this->hiddenId->getValue()."'";
       $result = mysql_query($query1)or die(mysql_error());

       $arr = array();
       while($row = mysql_fetch_array($result))
       {
         $entry_date = "<a href=veh_journal_edit.php?veh=".$this->hiddenId->getValue()."&journal=".$row['journal_id'].">".$row['entry_date']."</a>";
         $arr[] = array(
                        'Entry Date' => $entry_date,
                        'Category' => $row['category'],
                        'Description' => $row['summary_desc']
                        );

       }

       $this->JTPlatinumGrid2->setCellData($arr);


       }

       function JTPlatinumGrid1Show($sender, $params)
       {
       $query0 = "select * from veh_emission_tbl where vehicle_id='".$this->hiddenId->getValue()."'";
       $result0 = mysql_query($query0)or die(mysql_error());

       $arr = array();
       while($row = mysql_fetch_array($result0))
       {
         $test_date = "<a href=veh_emission_edit.php?veh=".$this->hiddenId->getValue()."&emission=".$row['emission_id'].">".$row['inspection_date']."</a>";

         $arr[] = array(
                        'Test Date' => $test_date,
                        'Valid Thru' => $row['validity_date'],
                        'Inspector' => $row['inspector']
                        );

        }

        $this->JTPlatinumGrid1->setCellData($arr);


        }



       function chkLockJSChange($sender, $params)
       {

       ?>
       //document.getElementById('f-calendar-field-1').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-2').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-3').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-4').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-5').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-6').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-7').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-8').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-9').style.backgroundColor = '#FFFFFF';
       //document.getElementById('f-calendar-field-10').style.backgroundColor = '#FFFFFF';
       document.getElementById('lblattach').style.color = '#3BB9FF';
       //Add your javascript code here
       if (document.Vehicle_Details.chkLock.checked == true)
       {
       document.Vehicle_Details.chkL1.disabled = true;

       //chkR1
       //document.Vehicle_Details.chkR1.disabled = true;
       //document.Vehicle_Details.chkR1.style.visibility = 'visible';
       //document.Vehicle_Details.chkHidden1.style.visibility = 'hidden';

       document.Vehicle_Details.cmbType1.disabled = true;

       document.Vehicle_Details.chkL2.disabled = true;
       document.Vehicle_Details.chkL2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden2.style.visibility = 'hidden';
       document.Vehicle_Details.chkR2.disabled = true;
       document.Vehicle_Details.chkR2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden3.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType2.disabled = true;

       document.Vehicle_Details.chkL3.disabled = true;
       document.Vehicle_Details.chkL3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden4.style.visibility = 'hidden';
       document.Vehicle_Details.chkR3.disabled = true;
       document.Vehicle_Details.chkR3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden5.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType3.disabled = true;

       document.Vehicle_Details.chkL4.disabled = true;
       document.Vehicle_Details.chkL4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden6.style.visibility = 'hidden';
       document.Vehicle_Details.chkR4.disabled = true;
       document.Vehicle_Details.chkR4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden7.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType4.disabled = true;

       document.Vehicle_Details.chkL5.disabled = true;
       document.Vehicle_Details.chkL5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden8.style.visibility = 'hidden';
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden9.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType5.disabled = true;

       document.Vehicle_Details.chkL6.disabled = true;
       document.Vehicle_Details.chkL6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden10.style.visibility = 'hidden';
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden11.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType6.disabled = true;
       }
       else
       {
       if (document.Vehicle_Details.chkL1.checked == false)
       {
       document.Vehicle_Details.chkL1.disabled = false;
       }

       if (document.Vehicle_Details.chkL1.checked == true)
       {

       document.Vehicle_Details.chkL1.disabled = false;
       //document.Vehicle_Details.chkR1.disabled = false;
       //document.Vehicle_Details.chkR1.style.visibility = 'visible';
       //document.Vehicle_Details.chkHidden1.style.visibility = 'hidden';
       document.Vehicle_Details.chkL2.disabled = false;
       document.Vehicle_Details.chkL2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden2.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType1.disabled = false;
       }

       if (document.Vehicle_Details.chkL2.checked == true)
       {
       document.Vehicle_Details.chkL2.disabled = false;
       document.Vehicle_Details.chkL2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden2.style.visibility = 'hidden';
       document.Vehicle_Details.chkR2.disabled = false;
       document.Vehicle_Details.chkR2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden3.style.visibility = 'hidden';
       document.Vehicle_Details.chkL3.disabled = false;
       document.Vehicle_Details.chkL3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden4.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType2.disabled = false;
       }

       if (document.Vehicle_Details.chkL3.checked == true)
       {
       document.Vehicle_Details.chkL3.disabled = false;
       document.Vehicle_Details.chkL3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden4.style.visibility = 'hidden';
       document.Vehicle_Details.chkR3.disabled = false;
       document.Vehicle_Details.chkR3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden5.style.visibility = 'hidden';
       document.Vehicle_Details.chkL4.disabled = false;
       document.Vehicle_Details.chkL4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden6.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType3.disabled = false;
       }

       if (document.Vehicle_Details.chkL4.checked == true)
       {
       document.Vehicle_Details.chkL4.disabled = false;
       document.Vehicle_Details.chkL4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden6.style.visibility = 'hidden';
       document.Vehicle_Details.chkR4.disabled = false;
       document.Vehicle_Details.chkR4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden7.style.visibility = 'hidden';
       document.Vehicle_Details.chkL5.disabled = false;
       document.Vehicle_Details.chkL5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden8.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType4.disabled = false;
       }

       if (document.Vehicle_Details.chkL5.checked == true)
       {
       document.Vehicle_Details.chkL5.disabled = false;
       document.Vehicle_Details.chkL5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden8.style.visibility = 'hidden';
       document.Vehicle_Details.chkR5.disabled = false;
       document.Vehicle_Details.chkR5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden9.style.visibility = 'hidden';
       document.Vehicle_Details.chkL6.disabled = false;
       document.Vehicle_Details.chkL6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden10.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType5.disabled = false;
       }

       if (document.Vehicle_Details.chkL6.checked == true)
       {
       document.Vehicle_Details.chkL6.disabled = false;
       document.Vehicle_Details.chkL6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden10.style.visibility = 'hidden';
       document.Vehicle_Details.chkR6.disabled = false;
       document.Vehicle_Details.chkR6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden11.style.visibility = 'hidden';
       document.Vehicle_Details.cmbType6.disabled = false;
       }
       }
       <?php

       }







       function chkR6JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR6.checked == true)
       {
       document.images['imgNoTire6'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire6'].src="image/tire1.jpg"
       }
       <?php

       }

       function chkL6JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL6.checked == true)
       {
       document.Vehicle_Details.chkR6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden11.style.visibility = 'hidden';
       document.Vehicle_Details.chkR6.disabled = false;
       document.Vehicle_Details.cmbType6.disabled = false;
       document.images['imgNoTire6'].src="image/tire1.jpg"
       }
       else
       {
       document.Vehicle_Details.chkHidden11.style.visibility = 'visible';
       document.Vehicle_Details.chkR6.style.visibility = 'hidden';
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php

       }


       function chkR5JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR5.checked == true)
       {
       document.images['imgNoTire5'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire5'].src="image/tire1.jpg"
       }
       <?php

       }

       function chkL5JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL5.checked == true)
       {
       document.Vehicle_Details.chkR5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden9.style.visibility = 'hidden';
       document.Vehicle_Details.chkL6.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden10.style.visibility = 'hidden';
       document.Vehicle_Details.chkR5.disabled = false;
       document.Vehicle_Details.chkL6.disabled = false;
       document.Vehicle_Details.cmbType5.disabled = false;
       document.images['imgNoTire5'].src="image/tire1.jpg"
       }
       else
       {
       document.Vehicle_Details.chkHidden9.style.visibility = 'visible';
       document.Vehicle_Details.chkR5.style.visibility = 'hidden';
       document.Vehicle_Details.chkHidden10.style.visibility = 'visible';
       document.Vehicle_Details.chkL6.style.visibility = 'hidden';
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.checked = false;
       document.Vehicle_Details.chkL6.disabled = true;
       document.Vehicle_Details.chkL6.checked = false;
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType5.disabled = true;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire5'].src="image/notire.png"
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php

       }

       function chkR4JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR4.checked == true)
       {
       document.images['imgNoTire4'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire4'].src="image/tire1.jpg"
       }
       <?php

       }


       function chkL4JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL4.checked == true)
       {
       document.Vehicle_Details.chkR4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden7.style.visibility = 'hidden';
       document.Vehicle_Details.chkL5.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden8.style.visibility = 'hidden';
       document.Vehicle_Details.chkR4.disabled = false;
       document.Vehicle_Details.chkL5.disabled = false;
       document.Vehicle_Details.cmbType4.disabled = false;
       document.images['imgNoTire4'].src="image/tire1.jpg"
       }
       else
       {
       document.Vehicle_Details.chkHidden7.style.visibility = 'visible';
       document.Vehicle_Details.chkR4.style.visibility = 'hidden';
       document.Vehicle_Details.chkHidden8.style.visibility = 'visible';
       document.Vehicle_Details.chkL5.style.visibility = 'hidden';
       document.Vehicle_Details.chkR4.disabled = true;
       document.Vehicle_Details.chkR4.checked = false;
       document.Vehicle_Details.chkL5.disabled = true;
       document.Vehicle_Details.chkL5.checked = false;
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.checked = false;
       document.Vehicle_Details.chkL6.disabled = true;
       document.Vehicle_Details.chkL6.checked = false;
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType4.disabled = true;
       document.Vehicle_Details.cmbType5.disabled = true;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire4'].src="image/notire.png"
       document.images['imgNoTire5'].src="image/notire.png"
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php

       }


       function chkR3JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR3.checked == true)
       {
       document.images['imgNoTire3'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire3'].src="image/tire1.jpg"
       }
       <?php

       }


       function chkL3JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL3.checked == true)
       {
       document.Vehicle_Details.chkR3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden5.style.visibility = 'hidden';
       document.Vehicle_Details.chkL4.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden6.style.visibility = 'hidden';
       document.Vehicle_Details.chkR3.disabled = false;
       document.Vehicle_Details.chkL4.disabled = false;
       document.Vehicle_Details.cmbType3.disabled = false;
       document.images['imgNoTire3'].src="image/tire1.jpg"
       }
       else
       {
       document.Vehicle_Details.chkHidden5.style.visibility = 'visible';
       document.Vehicle_Details.chkR3.style.visibility = 'hidden';
       document.Vehicle_Details.chkHidden6.style.visibility = 'visible';
       document.Vehicle_Details.chkL4.style.visibility = 'hidden';
       document.Vehicle_Details.chkR3.disabled = true;
       document.Vehicle_Details.chkR3.checked = false;
       document.Vehicle_Details.chkL4.disabled = true;
       document.Vehicle_Details.chkL4.checked = false;
       document.Vehicle_Details.chkR4.disabled = true;
       document.Vehicle_Details.chkR4.checked = false;
       document.Vehicle_Details.chkL5.disabled = true;
       document.Vehicle_Details.chkL5.checked = false;
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.checked = false;
       document.Vehicle_Details.chkL6.disabled = true;
       document.Vehicle_Details.chkL6.checked = false;
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType3.disabled = true;
       document.Vehicle_Details.cmbType4.disabled = true;
       document.Vehicle_Details.cmbType5.disabled = true;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire3'].src="image/notire.png"
       document.images['imgNoTire4'].src="image/notire.png"
       document.images['imgNoTire5'].src="image/notire.png"
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php

       }


       function chkR2JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR2.checked == true)
       {
       document.images['imgNoTire2'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire2'].src="image/tire1.jpg"
       }
       <?php

       }

       function chkL2JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL2.checked == true)
       {
       document.Vehicle_Details.chkR2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden3.style.visibility = 'hidden';
       document.Vehicle_Details.chkL3.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden4.style.visibility = 'hidden';
       document.Vehicle_Details.chkR2.disabled = false;
       document.Vehicle_Details.chkL3.disabled = false;
       document.Vehicle_Details.cmbType2.disabled = false;
       document.images['imgNoTire2'].src="image/tire1.jpg"
       }
       else
       {
       document.Vehicle_Details.chkHidden3.style.visibility = 'visible';
       document.Vehicle_Details.chkR2.style.visibility = 'hidden';
       document.Vehicle_Details.chkHidden4.style.visibility = 'visible';
       document.Vehicle_Details.chkL3.style.visibility = 'hidden';
       document.Vehicle_Details.chkR2.disabled = true;
       document.Vehicle_Details.chkR2.checked = false;
       document.Vehicle_Details.chkL3.disabled = true;
       document.Vehicle_Details.chkL3.checked = false;
       document.Vehicle_Details.chkR3.disabled = true;
       document.Vehicle_Details.chkR3.checked = false;
       document.Vehicle_Details.chkL4.disabled = true;
       document.Vehicle_Details.chkL4.checked = false;
       document.Vehicle_Details.chkR4.disabled = true;
       document.Vehicle_Details.chkR4.checked = false;
       document.Vehicle_Details.chkL4.disabled = true;
       document.Vehicle_Details.chkL5.checked = false;
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.checked = false;
       document.Vehicle_Details.chkL5.disabled = true;
       document.Vehicle_Details.chkL6.checked = false;
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType2.disabled = true;
       document.Vehicle_Details.cmbType3.disabled = true;
       document.Vehicle_Details.cmbType4.disabled = true;
       document.Vehicle_Details.cmbType5.disabled = true;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire2'].src="image/notire.png"
       document.images['imgNoTire3'].src="image/notire.png"
       document.images['imgNoTire4'].src="image/notire.png"
       document.images['imgNoTire5'].src="image/notire.png"
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php

       }

       function chkR1JSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkR1.checked == true)
       {
       document.images['imgNoTire1'].src="image/tire2.jpg"
       }
       else
       {
       document.images['imgNoTire1'].src="image/tire1.jpg"
       }
       <?php

       }


       function chkL1JSChange($sender, $params)
       {
       ?>
       //Add your javascript code here
       if (document.Vehicle_Details.chkL1.checked == true)
       {
       //document.Vehicle_Details.chkR1.style.visibility = 'visible';
       //document.Vehicle_Details.chkHidden1.style.visibility = 'hidden';
       document.Vehicle_Details.chkL2.style.visibility = 'visible';
       document.Vehicle_Details.chkHidden2.style.visibility = 'hidden';
       //document.Vehicle_Details.chkR1.disabled = false;
       document.Vehicle_Details.chkL2.disabled = false;
       document.Vehicle_Details.cmbType1.disabled = false;
       document.images['imgNoTire1'].src="image/tire1.jpg"
       }
       else
       {
       //document.Vehicle_Details.chkHidden1.style.visibility = 'visible';
       //document.Vehicle_Details.chkR1.style.visibility = 'hidden';
       document.Vehicle_Details.chkHidden2.style.visibility = 'visible';
       document.Vehicle_Details.chkL2.style.visibility = 'hidden';
       //document.Vehicle_Details.chkR1.disabled = true;
       //document.Vehicle_Details.chkR1.checked = false;
       document.Vehicle_Details.chkL2.disabled = true;
       document.Vehicle_Details.chkL2.checked = false;
       document.Vehicle_Details.chkR2.disabled = true;
       document.Vehicle_Details.chkR2.checked = false;
       document.Vehicle_Details.chkL3.disabled = true;
       document.Vehicle_Details.chkL3.checked = false;
       document.Vehicle_Details.chkR3.disabled = true;
       document.Vehicle_Details.chkR3.checked = false;
       document.Vehicle_Details.chkL4.disabled = true;
       document.Vehicle_Details.chkL4.checked = false;
       document.Vehicle_Details.chkR4.disabled = true;
       document.Vehicle_Details.chkR4.checked = false;
       document.Vehicle_Details.chkL5.disabled = true;
       document.Vehicle_Details.chkL5.checked = false;
       document.Vehicle_Details.chkR5.disabled = true;
       document.Vehicle_Details.chkR5.checked = false;
       document.Vehicle_Details.chkL6.disabled = true;
       document.Vehicle_Details.chkL6.checked = false;
       document.Vehicle_Details.chkR6.disabled = true;
       document.Vehicle_Details.chkR6.checked = false;
       document.Vehicle_Details.cmbType1.disabled = true;
       document.Vehicle_Details.cmbType2.disabled = true;
       document.Vehicle_Details.cmbType3.disabled = true;
       document.Vehicle_Details.cmbType4.disabled = true;
       document.Vehicle_Details.cmbType5.disabled = true;
       document.Vehicle_Details.cmbType6.disabled = true;
       document.images['imgNoTire1'].src="image/notire.png"
       document.images['imgNoTire2'].src="image/notire.png"
       document.images['imgNoTire3'].src="image/notire.png"
       document.images['imgNoTire4'].src="image/notire.png"
       document.images['imgNoTire5'].src="image/notire.png"
       document.images['imgNoTire6'].src="image/notire.png"
       }
       <?php
       }

}

global $application;

global $Vehicle_Details;

//Creates the form
$Vehicle_Details = new Vehicle_Details($application);

//Read from resource file
$Vehicle_Details->loadResource(__FILE__);

//Shows the form
$Vehicle_Details->show();

?>